[Gnus] Restructure and simplify configuration

No need to keep those large junks of setq in the :init block of use-package,
moved them to top level.
This commit is contained in:
Daniel - 2019-02-02 18:22:07 +01:00
parent cfda96a070
commit 966807281f
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 224 additions and 221 deletions

91
init.el
View File

@ -1197,8 +1197,6 @@
;; * Mail ;; * Mail
(setq send-mail-function 'smtpmail-send-it)
(use-package db-mail (use-package db-mail
:commands (db/public-key :commands (db/public-key
db/encryption-possible-p db/encryption-possible-p
@ -1225,9 +1223,9 @@
(add-hook 'mail-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)))
(use-package gnus ;; General Gnus configuration
:commands (gnus)
:init (setq gnus-init-file (expand-file-name "gnus.el" emacs-d) (setq gnus-init-file (expand-file-name "gnus.el" emacs-d)
gnus-home-directory (expand-file-name "~/Mail/news/") gnus-home-directory (expand-file-name "~/Mail/news/")
gnus-directory (expand-file-name "~/Mail/news/") gnus-directory (expand-file-name "~/Mail/news/")
gnus-kill-files-directory gnus-directory gnus-kill-files-directory gnus-directory
@ -1235,8 +1233,6 @@
gnus-cache-directory (expand-file-name "cache/" gnus-directory) gnus-cache-directory (expand-file-name "cache/" gnus-directory)
gnus-verbose 10 gnus-verbose 10
;; General Configuration
message-dont-reply-to-names (regexp-opt (cons user-mail-address message-dont-reply-to-names (regexp-opt (cons user-mail-address
db/additional-mail-addresses) db/additional-mail-addresses)
'words) 'words)
@ -1294,9 +1290,17 @@
"X-Jabber-ID:" "X-Jabber-ID:"
"User-Agent:")) "User-Agent:"))
;; Appearence message-citation-line-function
(lambda ()
(when message-reply-headers
(insert "ghItlhpu' "
(mail-header-from message-reply-headers)
":")
(newline))))
gnus-group-line-format "%S%p%P%5y(%2i):%B%(%s:%G%)\n" ;; Gnus Appearence
(setq gnus-group-line-format "%S%p%P%5y(%2i):%B%(%s:%G%)\n"
gnus-auto-select-first nil gnus-auto-select-first nil
gnus-auto-select-next nil gnus-auto-select-next nil
gnus-summary-line-format "%U%O%R%6k %(%&user-date; %-13,13f %B%s%)\n" gnus-summary-line-format "%U%O%R%6k %(%&user-date; %-13,13f %B%s%)\n"
@ -1335,11 +1339,11 @@
gnus-treat-strip-multiple-blank-lines nil gnus-treat-strip-multiple-blank-lines nil
gnus-treat-display-smileys t gnus-treat-display-smileys t
gnus-treat-emphasize 'head gnus-treat-emphasize 'head
gnus-treat-unsplit-urls t gnus-treat-unsplit-urls t)
;; Adaptive Scoring ;; Adaptive Scoring
gnus-use-scoring nil (setq gnus-use-scoring nil
gnus-use-adaptive-scoring nil gnus-use-adaptive-scoring nil
gnus-adaptive-word-length-limit 5 gnus-adaptive-word-length-limit 5
gnus-adaptive-word-no-group-words t gnus-adaptive-word-no-group-words t
@ -1365,11 +1369,11 @@
("^nntp.*" ("^nntp.*"
(gnus-use-scoring nil) (gnus-use-scoring nil)
(gnus-summary-mark-below -1000) (gnus-summary-mark-below -1000)
(gnus-use-adaptive-scoring '(word line)))) (gnus-use-adaptive-scoring '(word line)))))
;; Gnus Registry ;; Gnus Registry
gnus-registry-split-strategy 'majority (setq gnus-registry-split-strategy 'majority
gnus-registry-ignored-groups '(("^nntp" t) gnus-registry-ignored-groups '(("^nntp" t)
("^nnfolder" t) ("^nnfolder" t)
("^nnir" t) ("^nnir" t)
@ -1379,28 +1383,22 @@
gnus-registry-track-extra '(sender subject recipient) gnus-registry-track-extra '(sender subject recipient)
gnus-registry-cache-file (expand-file-name "gnus.registry.eioioi" gnus-registry-cache-file (expand-file-name "gnus.registry.eioioi"
emacs-d) emacs-d)
gnus-refer-article-method 'current gnus-refer-article-method 'current)
;; MIME ;; MIME
gnus-ignored-mime-types '("text/x-vcard") (setq gnus-ignored-mime-types '("text/x-vcard")
message-forward-as-mime t message-forward-as-mime t
gnus-inhibit-mime-unbuttonizing nil gnus-inhibit-mime-unbuttonizing nil
gnus-buttonized-mime-types '("multipart/signed" "multipart/encrypted") gnus-buttonized-mime-types '("multipart/signed" "multipart/encrypted")
gnus-inhibit-images t gnus-inhibit-images t
gnus-blocked-images "." gnus-blocked-images "."
mm-text-html-renderer 'shr
message-citation-line-function mm-discouraged-alternatives '("text/richtext" "text/html"))
(lambda ()
(when message-reply-headers
(insert "ghItlhpu' "
(mail-header-from message-reply-headers)
":")
(newline)))
;; Signing and Encryption ;; Signing and Encryption
mm-encrypt-option nil (setq mm-encrypt-option nil
mm-sign-option nil mm-sign-option nil
mm-decrypt-option 'known mm-decrypt-option 'known
mm-verify-option 'known mm-verify-option 'known
@ -1410,27 +1408,34 @@
gnus-message-replysign t gnus-message-replysign t
gnus-message-replyencrypt t gnus-message-replyencrypt t
gnus-message-replysignencrypted t gnus-message-replysignencrypted t
mml-secure-cache-passphrase nil mml-secure-cache-passphrase nil)
;; Archiving: we store messages in the current group, so there is ;; Archiving
;; We store messages in the current group, so there is
;; no need to use Gnus archiving method ;; no need to use Gnus archiving method
gnus-message-archive-method nil (setq gnus-message-archive-method nil
gnus-update-message-archive-method t gnus-update-message-archive-method t
gnus-message-archive-group nil gnus-message-archive-group nil
gnus-gcc-mark-as-read t gnus-gcc-mark-as-read t)
;; Searching ;; Searching
nnir-method-default-engines '((nnimap . imap) (setq nnir-method-default-engines '((nnimap . imap)
(nnmaildir . notmuch) (nnmaildir . notmuch)
(nntp . gmane)) (nntp . gmane)))
;; Agents ;; Agents
gnus-agent-mark-unread-after-downloaded nil (setq gnus-agent-mark-unread-after-downloaded nil
gnus-agent-synchronize-flags t gnus-agent-synchronize-flags t
gnus-agent-go-online t) gnus-agent-go-online t)
;; Package configuration
(use-package gnus
:commands (gnus)
:config (progn :config (progn
(require 'db-mail) (require 'db-mail)
@ -1521,13 +1526,12 @@
(use-package mm-decode (use-package mm-decode
:defer t :defer t
:init (setq mm-text-html-renderer 'shr :config (progn
mm-discouraged-alternatives '("text/richtext" "text/html") (setq mm-automatic-display (-difference mm-automatic-display
mm-automatic-display (-difference mm-automatic-display
'("text/html" '("text/html"
"text/enriched" "text/enriched"
"text/richtext"))) "text/richtext")))
:config (progn
;; Automatically show PGP data inline ;; Automatically show PGP data inline
(add-to-list 'mm-inlined-types "application/pgp$") (add-to-list 'mm-inlined-types "application/pgp$")
(add-to-list 'mm-inline-media-tests (add-to-list 'mm-inline-media-tests
@ -1572,12 +1576,13 @@
(use-package mml (use-package mml
:defer t :defer t
:config (advice-add 'mml-attach-file :config (progn
:around #'db/mml-attach-file--go-to-eob)) ;; Move to end of message buffer before attaching a file
(advice-add 'mml-attach-file
:around #'db/mml-attach-file--go-to-eob)))
(use-package notmuch (setq notmuch-fcc-dirs nil
:defer t send-mail-function 'smtpmail-send-it)
:init (setq notmuch-fcc-dirs nil))
(use-package smtpmail (use-package smtpmail
:defer t :defer t
@ -1599,10 +1604,8 @@
smtpmail-smtp-server)))) smtpmail-smtp-server))))
(signal (car signals-data) (cdr signals-data))))))) (signal (car signals-data) (cdr signals-data)))))))
(use-package starttls (setq starttls-use-gnutls t
:defer t starttls-extra-arguments '("--strict-tofu"))
:init (setq starttls-use-gnutls t
starttls-extra-arguments '("--strict-tofu")))
;; * Crypto ;; * Crypto