Compare commits

...

5 Commits

1 changed files with 248 additions and 219 deletions

467
init.el
View File

@ -59,7 +59,7 @@
(load-file (expand-file-name "early-init.el" emacs-d))
(package-initialize))
(setq use-package-enable-imenu-support t)
(defvar use-package-enable-imenu-support t)
(eval-when-compile
(dolist (package '(bind-key use-package))
@ -132,15 +132,18 @@
(setq frame-title-format "emacs")
(setq select-enable-clipboard t ; TODO select.el
select-enable-primary t ; TODO select.el
(use-package help-fns
:defines (help-enable-symbol-autoload))
(setq select-enable-clipboard t
select-enable-primary t
save-interprogram-paste-before-kill t
mouse-yank-at-point t ; TODO? mouse.el
mouse-yank-at-point t
scroll-conservatively 10
scroll-preserve-screen-position 'always ; Make M-v undo C-v
message-log-max t
inhibit-eol-conversion nil
tab-always-indent 'complete ; TODO indent.el
tab-always-indent 'complete
enable-recursive-minibuffers t
set-mark-command-repeat-pop t
echo-keystrokes 0.1
@ -153,8 +156,8 @@
gc-cons-threshold (* 100 1024 1024) ; 100mb
read-process-output-max (* 1024 1024) ; 1mb
next-error-message-highlight t
help-enable-symbol-autoload t ; TODO? help.el
describe-bindings-outline t ; TODO? help.el
help-enable-symbol-autoload t
describe-bindings-outline t
redisplay-skip-fontification-on-input t
undo-limit 80000000
async-shell-command-buffer 'new-buffer
@ -342,6 +345,7 @@
(use-package dash
:defer nil
:autoload (-difference)
:config (progn
(global-dash-fontify-mode)
(dash-register-info-lookup)))
@ -546,6 +550,9 @@
:bind (:map org-mode-map
([remap org-return] . (lambda () (interactive) (org-return :indent)))
([remap org-clock-goto] . db/org-clock-goto-first-open-checkbox))
:autoload (org-get-todo-state
org-entry-get)
:commands (org-return)
:init (progn
(setq org-deadline-warning-days 14
org-read-date-popup-calendar t
@ -779,6 +786,7 @@
(use-package ol
:init (setq org-link-keep-stored-after-insertion t)
:commands (org-store-link)
:autoload (org-link-set-parameters)
:config (progn
(define-advice org-store-link (:around
@ -821,6 +829,13 @@
org-store-link--return-value))))
(use-package ol-bbdb
:config (add-to-list 'org-bbdb-anniversary-format-alist
(cons "day-of-death"
#'(lambda (name years suffix)
(format "Day of Death: [[bbdb:%s][%s (%s%s)]]"
name name years suffix)))))
(use-package org-id
:init (setq org-id-link-to-org-use-id t))
@ -873,7 +888,8 @@
;; Agenda
(use-package org-agenda
:commands (org-agenda)
:commands (org-agenda
org-agenda-redo-all)
:bind (:map org-agenda-mode-map
("i" . org-agenda-clock-in)
("v" . hydra-org-agenda-view/body)
@ -1247,13 +1263,7 @@ point to the beginning of buffer first."
ediff-window-setup-function 'ediff-setup-windows-plain
ediff-split-window-function 'split-window-horizontally
ediff-show-clashes-only t)
:config (progn
(add-hook 'ediff-keymap-setup-hook
#'(lambda ()
(bind-key "j" #'ediff-next-difference ediff-mode-map)
(bind-key "k" #'ediff-previous-difference ediff-mode-map)))
(add-hook 'ediff-after-quit-hook-internal 'winner-undo)))
:config (add-hook 'ediff-after-quit-hook-internal 'winner-undo))
(use-package flycheck
:ensure t
@ -1368,17 +1378,126 @@ point to the beginning of buffer first."
:config (progn
(add-hook 'message-setup-hook 'bbdb-mail-aliases)
(add-hook 'mail-setup-hook 'bbdb-mail-aliases)
(run-with-timer 0 3600 #'bbdb-save)
(run-with-timer 0 3600 #'bbdb-save)))
(with-eval-after-load 'ol-bbdb
(add-to-list 'org-bbdb-anniversary-format-alist
(cons "day-of-death"
#'(lambda (name years suffix)
(format "Day of Death: [[bbdb:%s][%s (%s%s)]]"
name name years suffix)))))))
;; Gnus package configuration
(use-package gnus
:commands (gnus)
:config (progn
(require 'db-mail)
(with-demoted-errors "Setting up BBDB failed: %s"
(bbdb-initialize 'gnus 'message)
(bbdb-mua-auto-update-init 'message))
;; Ensure that whenever we compose new mail, it will use the correct
;; posting style. This is ensured by setting ARG of
;; `gnus-group-mail to 1 to let it query the user for a group.
(defadvice gnus-group-mail (before inhibit-no-argument activate)
(unless (ad-get-arg 0)
(ad-set-arg 0 1)))
(remove-hook 'gnus-mark-article-hook
'gnus-summary-mark-read-and-unread-as-read)
(add-hook 'gnus-mark-article-hook 'gnus-summary-mark-unread-as-read)
;; Quit Gnus gracefully when exiting Emacs
(add-hook 'kill-emacs-hook #'(lambda ()
(interactive)
(when (get-buffer "*Group*")
(gnus-group-exit))))
;; Dont quit summary buffer when pressing `q
(bind-key "q" #'gnus-summary-expand-window gnus-article-mode-map)
;; Show topics in group buffer
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;; We need to do some magic as otherwise the agent does not delete
;; articles from its .overview when we move them around. Thus we
;; mark articles as expireable when they have been moved to another
;; group.
(defadvice gnus-summary-move-article (around
no-cancel-mark
(&optional n to-newsgroup
select-method action)
activate)
(let ((articles (gnus-summary-work-articles n))
(return ad-do-it))
(when (or (null action)
(eq action 'move))
(dolist (article articles)
(gnus-summary-mark-article article gnus-expirable-mark)))
return))
;; Increase score of group after reading it
(add-hook 'gnus-summary-exit-hook
'gnus-summary-bubble-group)
;; Use Gnus registry; doing this too early conflicts with `gnus'
;; calling `gnus-shutdown', which in turn calls
;; `gnus-registry-clear', leaving us with an empty registry upon
;; startup. So let's call this initialization right before startup,
;; that should be fine.
(add-hook 'gnus-before-startup-hook
#'gnus-registry-initialize)
;; Automatic encryption if all necessary keys are present
(add-hook 'gnus-message-setup-hook
#'db/signencrypt-message-when-possible)
;; Do some pretty printing before saving the newsrc file
(add-hook 'gnus-save-quick-newsrc-hook
#'db/gnus-save-newsrc-with-whitespace-1)
;; Automatically scan for new news
(gnus-demon-add-handler 'db/gnus-demon-scan-news-on-level-2 5 5)
;; Automatically expire groups on idle
(gnus-demon-add-handler 'gnus-group-expire-all-groups 10 5)
;; Visit group under point and immediately close it; this updates
;; gnus registry as a side-effect
(bind-key "v u"
#'(lambda ()
(interactive)
(save-mark-and-excursion
(when (gnus-topic-select-group)
(gnus-summary-exit))))
gnus-group-mode-map)
;; Toggle visibility of News group
(bind-key "v c"
#'(lambda ()
(interactive)
(save-mark-and-excursion
(gnus-topic-jump-to-topic "News")
(gnus-topic-read-group)))
gnus-group-mode-map)
(bind-key "C-<return>" #'db/gnus-summary-open-Link gnus-summary-mode-map)
(bind-key "C-<return>" #'db/gnus-summary-open-Link gnus-article-mode-map)))
(use-package gnus-topic
:commands (gnus-topic-select-group
gnus-topic-jump-to-topic
gnus-topic-read-group))
(use-package gnus-demon
:autoload (gnus-demon-add-handler))
(use-package gnus-group
:commands (gnus-group-exit))
;; General Gnus configuration
(use-package nntp)
(use-package nnml)
(use-package message)
(use-package gnus-msg)
(use-package gnus-async)
(setq gnus-init-file (expand-file-name "gnus.el" emacs-d)
gnus-home-directory (expand-file-name "~/.config/gnus-news")
gnus-directory gnus-home-directory
@ -1402,46 +1521,17 @@ point to the beginning of buffer first."
gnus-check-new-newsgroups nil
gnus-use-cache 'passive
gnus-read-active-file 'some
gnus-build-sparse-threads 'some
gnus-subscribe-newsgroup-method 'gnus-subscribe-killed
gnus-group-list-inactive-groups t
gnus-suppress-duplicates nil
gnus-large-newsgroup 500
nnmail-expiry-wait 7
nnmail-cache-accepted-message-ids t
gnus-summary-next-group-on-exit nil
gnus-use-full-window nil
gnus-always-force-window-configuration t
gnus-fetch-old-headers nil
gnus-select-method '(nnnil "")
gnus-refer-article-method 'current
gnus-visible-headers (regexp-opt '("From:"
"Newsgroups:"
"Subject:"
"Date:"
"Followup-To:"
"Reply-To:"
"Organization:"
"Summary:"
"Keywords:"
"Mail-Copies-To:"
"To:"
"Cc:"
"BCC:"
"X-Newsreader:"
"X-Mailer:"
"X-Sent:"
"Posted-To:"
"Mail-Copies-To:"
"Apparently-To:"
"Gnus-Warning:"
"Resent-From:"
"gpg-key-ID:"
"fingerprint:"
"X-Jabber-ID:"
"User-Agent:"))
message-citation-line-function
#'(lambda ()
(when message-reply-headers
@ -1452,74 +1542,106 @@ point to the beginning of buffer first."
;; Gnus Appearence
(setq gnus-group-line-format "%S%p%P%5y(%2i):%B%(%s:%G%)\n"
gnus-auto-select-first nil
gnus-auto-select-next nil
gnus-summary-line-format "%U%O%R%6k %(%&user-date; %-13,13f %B%s%)\n"
gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date)
gnus-subthread-sort-functions '(gnus-thread-sort-by-date)
gnus-thread-hide-subtree t
gnus-user-date-format-alist '((t . "%Y-%m-%d %H:%M"))
gnus-sum-thread-tree-indent " "
gnus-sum-thread-tree-root ""
gnus-sum-thread-tree-false-root ""
gnus-sum-thread-tree-single-indent ""
gnus-sum-thread-tree-single-leaf "╰► "
gnus-sum-thread-tree-leaf-with-other "├► "
gnus-sum-thread-tree-vertical ""
gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references
(use-package gnus-sum
:commands (gnus-summary-exit
gnus-summary-expand-window)
:init (setq gnus-group-line-format "%S%p%P%5y(%2i):%B%(%s:%G%)\n"
gnus-build-sparse-threads 'some
gnus-summary-next-group-on-exit nil
gnus-fetch-old-headers nil
gnus-auto-select-first nil
gnus-auto-select-next nil
gnus-summary-line-format "%U%O%R%6k %(%&user-date; %-13,13f %B%s%)\n"
gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date)
gnus-subthread-sort-functions '(gnus-thread-sort-by-date)
gnus-thread-hide-subtree t
gnus-user-date-format-alist '((t . "%Y-%m-%d %H:%M"))
gnus-sum-thread-tree-indent " "
gnus-sum-thread-tree-root ""
gnus-sum-thread-tree-false-root ""
gnus-sum-thread-tree-single-indent ""
gnus-sum-thread-tree-single-leaf "╰► "
gnus-sum-thread-tree-leaf-with-other "├► "
gnus-sum-thread-tree-vertical ""
gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references
;; New mark symbols (seen here:
;; `https://github.com/cofi/dotfiles/blob/master/gnus.el')
gnus-ancient-mark ?✓
;; gnus-cached-mark ?☍
gnus-canceled-mark ?↗
gnus-del-mark ?✗
;; gnus-dormant-mark ?⚐
gnus-expirable-mark ?♻
gnus-forwarded-mark ?↪
;; gnus-killed-mark ?☠
;; gnus-process-mark ?⚙
gnus-read-mark ?✓
gnus-recent-mark ?✩
gnus-replied-mark ?↺
gnus-unread-mark ?✉
;; gnus-unseen-mark ?★
;; gnus-ticked-mark ?⚑
gnus-treat-hide-boring-headers 'head
gnus-treat-strip-multiple-blank-lines nil
gnus-treat-display-smileys t
gnus-treat-emphasize 'head
gnus-treat-unsplit-urls t)
;; New mark symbols (seen here:
;; `https://github.com/cofi/dotfiles/blob/master/gnus.el')
gnus-ancient-mark ?✓
;; gnus-cached-mark ?☍
gnus-canceled-mark ?↗
gnus-del-mark ?✗
;; gnus-dormant-mark ?⚐
gnus-expirable-mark ?♻
gnus-forwarded-mark ?↪
;; gnus-killed-mark ?☠
;; gnus-process-mark ?⚙
gnus-read-mark ?✓
gnus-recent-mark ?✩
gnus-replied-mark ?↺
gnus-unread-mark ?✉
;; gnus-unseen-mark ?★
;; gnus-ticked-mark ?⚑
))
(use-package gnus-art
:init (setq gnus-ignored-mime-types '("text/x-vcard")
gnus-inhibit-mime-unbuttonizing nil
gnus-buttonized-mime-types '("multipart/signed" "multipart/encrypted")
gnus-inhibit-images t
gnus-blocked-images ".*"))
gnus-blocked-images ".*"
gnus-visible-headers (regexp-opt '("From:"
"Newsgroups:"
"Subject:"
"Date:"
"Followup-To:"
"Reply-To:"
"Organization:"
"Summary:"
"Keywords:"
"Mail-Copies-To:"
"To:"
"Cc:"
"BCC:"
"X-Newsreader:"
"X-Mailer:"
"X-Sent:"
"Posted-To:"
"Mail-Copies-To:"
"Apparently-To:"
"Gnus-Warning:"
"Resent-From:"
"gpg-key-ID:"
"fingerprint:"
"X-Jabber-ID:"
"User-Agent:"))
gnus-treat-hide-boring-headers 'head
gnus-treat-strip-multiple-blank-lines nil
gnus-treat-display-smileys t
gnus-treat-emphasize 'head
gnus-treat-unsplit-urls t))
;; Adaptive Scoring
(setq gnus-use-scoring t
gnus-use-adaptive-scoring '(word line)
gnus-summary-mark-below nil
gnus-adaptive-word-length-limit 5
gnus-adaptive-word-no-group-words t
gnus-default-adaptive-score-alist
'((gnus-unread-mark)
(gnus-ticked-mark (from 4))
(gnus-dormant-mark (from 5))
(gnus-del-mark (from -4) (subject -1))
(gnus-read-mark (from 4) (subject 2))
(gnus-expirable-mark (from -1) (subject -1))
(gnus-killed-mark (from -1) (subject -3))
(gnus-kill-file-mark)
(gnus-ancient-mark)
(gnus-low-score-mark)
(gnus-catchup-mark (from -1) (subject -1)))
gnus-summary-mark-below nil)
(use-package gnus-score
:init (setq gnus-use-scoring t
gnus-use-adaptive-scoring '(word line)
gnus-summary-mark-below nil
gnus-adaptive-word-length-limit 5
gnus-adaptive-word-no-group-words t
gnus-default-adaptive-score-alist
'((gnus-unread-mark)
(gnus-ticked-mark (from 4))
(gnus-dormant-mark (from 5))
(gnus-del-mark (from -4) (subject -1))
(gnus-read-mark (from 4) (subject 2))
(gnus-expirable-mark (from -1) (subject -1))
(gnus-killed-mark (from -1) (subject -3))
(gnus-kill-file-mark)
(gnus-ancient-mark)
(gnus-low-score-mark)
(gnus-catchup-mark (from -1) (subject -1)))
gnus-summary-mark-below nil))
;; Gnus Registry
@ -1642,106 +1764,6 @@ point to the beginning of buffer first."
gnus-agent-synchronize-flags t
gnus-agent-go-online t))
;; Package configuration
(use-package gnus
:commands (gnus)
:config (progn
(require 'db-mail)
(with-demoted-errors "Setting up BBDB failed: %s"
(bbdb-initialize 'gnus 'message)
(bbdb-mua-auto-update-init 'message))
;; Ensure that whenever we compose new mail, it will use the correct
;; posting style. This is ensured by setting ARG of
;; `gnus-group-mail to 1 to let it query the user for a group.
(defadvice gnus-group-mail (before inhibit-no-argument activate)
(unless (ad-get-arg 0)
(ad-set-arg 0 1)))
(remove-hook 'gnus-mark-article-hook
'gnus-summary-mark-read-and-unread-as-read)
(add-hook 'gnus-mark-article-hook 'gnus-summary-mark-unread-as-read)
;; Quit Gnus gracefully when exiting Emacs
(add-hook 'kill-emacs-hook #'(lambda ()
(interactive)
(when (get-buffer "*Group*")
(gnus-group-exit))))
;; Dont quit summary buffer when pressing `q
(bind-key "q" #'gnus-summary-expand-window gnus-article-mode-map)
;; Show topics in group buffer
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;; We need to do some magic as otherwise the agent does not delete
;; articles from its .overview when we move them around. Thus we
;; mark articles as expireable when they have been moved to another
;; group.
(defadvice gnus-summary-move-article (around
no-cancel-mark
(&optional n to-newsgroup
select-method action)
activate)
(let ((articles (gnus-summary-work-articles n))
(return ad-do-it))
(when (or (null action)
(eq action 'move))
(dolist (article articles)
(gnus-summary-mark-article article gnus-expirable-mark)))
return))
;; Increase score of group after reading it
(add-hook 'gnus-summary-exit-hook
'gnus-summary-bubble-group)
;; Use Gnus registry; doing this too early conflicts with `gnus'
;; calling `gnus-shutdown', which in turn calls
;; `gnus-registry-clear', leaving us with an empty registry upon
;; startup. So let's call this initialization right before startup,
;; that should be fine.
(add-hook 'gnus-before-startup-hook
#'gnus-registry-initialize)
;; Automatic encryption if all necessary keys are present
(add-hook 'gnus-message-setup-hook
#'db/signencrypt-message-when-possible)
;; Do some pretty printing before saving the newsrc file
(add-hook 'gnus-save-quick-newsrc-hook
#'db/gnus-save-newsrc-with-whitespace-1)
;; Automatically scan for new news
(gnus-demon-add-handler 'db/gnus-demon-scan-news-on-level-2 5 5)
;; Automatically expire groups on idle
(gnus-demon-add-handler 'gnus-group-expire-all-groups 10 5)
;; Visit group under point and immediately close it; this updates
;; gnus registry as a side-effect
(bind-key "v u"
#'(lambda ()
(interactive)
(save-mark-and-excursion
(when (gnus-topic-select-group)
(gnus-summary-exit))))
gnus-group-mode-map)
;; Toggle visibility of News group
(bind-key "v c"
#'(lambda ()
(interactive)
(save-mark-and-excursion
(gnus-topic-jump-to-topic "News")
(gnus-topic-read-group)))
gnus-group-mode-map)
(bind-key "C-<return>" #'db/gnus-summary-open-Link gnus-summary-mode-map)
(bind-key "C-<return>" #'db/gnus-summary-open-Link gnus-article-mode-map)))
;; Sending mail
(setq message-send-mail-function #'db/smtpmail-send-it
@ -2010,6 +2032,10 @@ point to the beginning of buffer first."
(use-package helm
:ensure t
:diminish helm-mode
:autoload (helm-execute-persistent-action
helm-select-action
helm-make-source)
:defines (helm-source-bookmarks) ; via helm-bookmarks.el
:init (setq helm-command-prefix-key "C-c h"
helm-input-idle-delay 0.0
helm-buffers-fuzzy-matching t
@ -2117,8 +2143,6 @@ With universal argument ARG, inhibit display of files in
is too slow (in this case, `db/important-document-path' should
eventuelly be set to nil, however)."
(interactive "P")
(eval-when-compile
(require 'helm-bookmark))
(helm :sources (list
(helm-make-source "Frequently Used" 'helm-source-sync
:candidates (mapcar #'(lambda (entry)
@ -2359,7 +2383,8 @@ eventuelly be set to nil, however)."
:filter-return #'(lambda (env) (cons "INSIDE_EMACS" env)))))
(use-package term
:commands (term-send-string)
:commands (term-send-string
term-send-raw)
:init (setq explicit-shell-file-name "/bin/bash")
:config (progn
(add-hook 'term-exec-hook ; oremacs.com
@ -2450,6 +2475,7 @@ eventuelly be set to nil, however)."
eshell-cd-on-directory t
eshell-expand-input-functions '(eshell-expand-history-references))
:config (progn
(eval-when-compile
(require 'em-prompt)
(require 'em-term)
@ -2494,7 +2520,7 @@ eventuelly be set to nil, however)."
(when on-windows
(add-to-list 'eshell-mode-hook
#'(lambda ()
(setq pcomplete-ignore-case nil))))
(setq completion-ignore-case nil))))
;; Sometimes, when completing path names and immediately
;; hitting RET, `completion-in-region-mode' still seems to be
@ -2524,16 +2550,19 @@ eventuelly be set to nil, however)."
;; determine whether the completion is not done yet, by passing
;; `exact' instead of `finished' to the handlers stored in
;; `completion-extra-properties'.
(defun db/set-empty-pcomplete-termination-string ()
"Locally set `pcomplete-termination-string' to the empty string."
(setq-local pcomplete-termination-string ""))
(add-hook 'eshell-mode-hook
#'db/set-empty-pcomplete-termination-string)
#'(lambda ()
(setq-local pcomplete-termination-string "")))
(require 'db-eshell)))
(use-package em-prompt ; Why is this extra declaration necessary?
:commands (eshell-previous-prompt
eshell-next-prompt))
(use-package esh-mode ; Why is this extra declaration necessary?
:commands (eshell-bol))
(use-package with-editor
:commands (with-editor-export-editor))