gnus.el 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ;; Password xoauth2 stuff
  2. (use-package auth-source-xoauth2 :ensure t)
  3. (require 'gnus-secrets "~/.gnus-secrets.el.gpg")
  4. (setq auth-source-xoauth2-creds 'my-xoauth2-get-secrets)
  5. (add-to-list 'smtpmail-auth-supported 'xoauth2)
  6. (auth-source-xoauth2-enable)
  7. (setq gnus-asynchronous t)
  8. ;;; Sending related stuff
  9. ;; Save sent file to same group where located (using GCC-field)
  10. (setq gnus-message-archive-method '(nnimap ""))
  11. (setq gnus-message-archive-group
  12. '((lambda (group)
  13. (cond
  14. ;; Store personal mail messages in the same group I started out in
  15. ((string-match "nnimap.*" group) group)
  16. ;; Store everything else in misc until I can sort it out
  17. (t "mail.misc")))))
  18. ;;; Level stuff (for speed etc.)
  19. ;; Read
  20. ;; https://www.gnu.org/software/emacs/manual/html_node/gnus/Group-Levels.html
  21. ;; and
  22. ;; https://emacs.stackexchange.com/questions/34537/how-to-prevent-gnus-from-querying-the-server-during-startup
  23. (setq gnus-activate-level 5) ; Default 6, groups with level above this
  24. ; won't be activated. Use 'S l' on a
  25. ; group to give it a new level (if you
  26. ; want to make it activated or not). Use
  27. ; e.g. '6 g' to refresh all groups level
  28. ; 6 or below.
  29. (setq gnus-check-new-newsgroups nil) ; don't check server for new
  30. ; stuff. Use 'U' in group buffer
  31. ; to add new groups.
  32. ;;; Highlighting: smallest set of conditions first
  33. (with-eval-after-load 'gnus-group
  34. (add-to-list 'gnus-group-highlight
  35. '((and mailp (>= level 4) (<= level 6))
  36. . gnus-group-mail-3))
  37. (add-to-list 'gnus-group-highlight
  38. '((and mailp (= unread 0) (>= level 4) (<= level 6))
  39. . gnus-group-mail-3-empty)))
  40. ;;; Interface stuff
  41. (setq gnus-summary-line-format "%U%R %&user-date; %B%-31,31s %4k %uB\n"
  42. ;; Default with %f ('Name, To header or Newsgroups header')
  43. ;; replaced by %uB (BBDB Name + Known poster indicator '+')
  44. gnus-user-date-format-alist '((t . "%Y-%m-%d %H:%M"))
  45. gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references
  46. gnus-summary-gather-subject-limit 'fuzzy
  47. gnus-fetch-old-headers t
  48. gnus-article-sort-functions '(gnus-article-sort-by-date)
  49. gnus-thread-sort-functions '((not gnus-thread-sort-by-most-recent-date))
  50. gnus-subthread-sort-functions '((not gnus-thread-sort-by-date))
  51. gnus-sum-thread-tree-false-root ""
  52. gnus-sum-thread-tree-indent " "
  53. gnus-sum-thread-tree-leaf-with-other "├► "
  54. gnus-sum-thread-tree-root ""
  55. gnus-sum-thread-tree-single-leaf "╰► "
  56. gnus-sum-thread-tree-vertical "│")
  57. ;; Make it so a read article marks duplicated read when seen them. So
  58. ;; articles in the backup server are marked as read (and total-expire
  59. ;; moves them to Trash) when reading them elsewhere. WARNING: reading
  60. ;; in the duplicate server marks them read elsewhere too.
  61. (setq gnus-suppress-duplicates t)
  62. ;; Also make it so that when on auto-expiry, only unread messages that
  63. ;; are read will be automatically marked as expired. I.e. something
  64. ;; explicitly marked as read 'd' will not be marked as expired under
  65. ;; auto-expire.
  66. (remove-hook 'gnus-mark-article-hook
  67. 'gnus-summary-mark-read-and-unread-as-read)
  68. ;; (add-hook 'gnus-mark-article-hook
  69. ;; 'gnus-summary-mark-unread-as-read)
  70. (add-hook 'gnus-summary-mode-hook 'my-alter-summary-map)
  71. (defun my-alter-summary-map ()
  72. ;; (keymap-local-set "E" 'gnus-summary-put-mark-as-expirable)
  73. ;; ^ it's better to move one down after pressing E.
  74. ;; (keymap-local-set "d" 'gnus-summary-mark-as-read-forward)
  75. (keymap-local-set "?" 'gnus-summary-put-mark-as-dormant)
  76. (keymap-local-set "!" 'gnus-summary-put-mark-as-ticked)
  77. (keymap-local-set "M-u" 'gnus-summary-put-mark-as-unread))
  78. (setq gnus-summary-goto-unread 'never) ;; go to next article (using
  79. ;; 'n' even it it's read)
  80. ;;; Security stuff
  81. (setq mm-verify-option "always"
  82. gnus-buttonized-mime-types '("multipart/signed") ; show verified key etc
  83. ;; mm-sign-option 'guided ; for always selecting signing key from a menu
  84. mml-secure-openpgp-encrypt-to-self t
  85. mml-secure-smime-encrypt-to-self t
  86. mml-secure-openpgp-sign-with-sender t
  87. mml-secure-smime-sign-with-sender t
  88. gnus-message-replysignencrypted t)
  89. (add-hook 'gnus-message-setup-hook 'mml-secure-message-sign-pgpmime) ; Always sign