Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 151 lines (130 sloc) 5.815 kB
919a2cc @cofi [Emacs] Add gnus config.
authored
1 ;;; org-contacts
2 (require-and-exec 'org-contacts
bf67106 @cofi [Emacs] Disable some funs.
authored
3 (org-contacts-gnus-insinuate)
4 ;; deactivate store last mail
5 (fset 'org-contacts-gnus-store-last-mail #'NOP))
919a2cc @cofi [Emacs] Add gnus config.
authored
6
7 ;;; methods
8 (setq imap-shell-program "/usr/lib/dovecot/imap -c ~/config/dovecot.conf"
9 gnus-select-method '(nnimap "Mail"
10 (nnimap-stream shell))
fd1d493 @cofi [Emacs] Add eternal september news server.
authored
11 gnus-secondary-select-methods '((nntp "news.gmane.org")
12 (nntp "news.eternal-september.org")))
919a2cc @cofi [Emacs] Add gnus config.
authored
13
14 ;;; sending
15 (setq sendmail-program "msmtp"
16 message-sendmail-extra-arguments '("-a" "gmail")
17 message-send-mail-function 'message-send-mail-with-sendmail)
18
19 (defun cofi/mml-ask-if-send ()
20 "Ask for send with preview."
21 (save-window-excursion
22 (mml-preview)
23 (unless (y-or-n-p "Send message? ")
24 (error "Abort."))))
25
26 (add-all-to-hook 'message-send-hook
27 #'cofi/mml-ask-if-send
28 (lambda ()
04caf01 @cofi [Emacs] Gnus: only ask for signing if there is no <#secure cookie.
authored
29 ;; only ask if there is no <#secure cookie
30 (unless (save-excursion
31 (goto-char 0)
32 (re-search-forward "<#secure" nil 'noerror))
33 (if (y-or-n-p "Sign message? ")
34 (mml-secure-message-sign))))
919a2cc @cofi [Emacs] Add gnus config.
authored
35 #'mail-attachment-check)
36
37 ;;; writing
38 (add-hook 'message-mode-hook #'cofi/write-mail)
39 (setq gnus-add-to-list t)
40
17b147e @cofi [Emacs] mail: mark gcc as read.
authored
41 (setq gnus-gcc-mark-as-read t)
919a2cc @cofi [Emacs] Add gnus config.
authored
42 ;;; fancy summary
43 (setq gnus-summary-line-format "%U|%R|%z|%ur|%(%-20&user-date;|%-30B%[%5L: %-40f%] %s%)\n")
44 (setq gnus-summary-make-false-root 'dummy
45 gnus-sum-thread-tree-false-root "┈─►"
46 gnus-sum-thread-tree-single-indent ""
47 gnus-sum-thread-tree-root ""
48 gnus-sum-thread-tree-vertical ""
49 gnus-sum-thread-tree-leaf-with-other "├─►"
50 gnus-sum-thread-tree-single-leaf "╰─►"
51 gnus-sum-thread-tree-indent " ")
52
49ae898 @cofi [Emacs] gnus: Switch to gnus-w3m renderer.
authored
53 (setq mm-text-html-renderer 'gnus-w3m)
919a2cc @cofi [Emacs] Add gnus config.
authored
54
55 ;;; search
56 (require 'nnir)
57
58 ;;; washing
59 ;; hide citations
60 (setq gnus-treat-hide-citation t
61 gnus-cited-lines-visible '(2 . 5))
62 ;; fill long lines on first part or text/plain
63 (setq gnus-treat-fill-long-lines '(or first (typep "text/plain")))
64
65 ;;; crypt
66 (setq gnus-message-replysign t
67 gnus-message-replyencrypt t
68 gnus-message-replysignencrypted t)
69 (setq gnus-message-replysign t)
70 (setq gnus-summary-force-verify-and-decrypt t)
71 (setq mm-verify-option 'always)
72 (setq mml2015-verbose t
ace7348 @cofi [Emacs] Gnus: Add signers.
authored
73 mml2015-encrypt-to-self t
74 mml2015-signers '("B4523295"))
919a2cc @cofi [Emacs] Add gnus config.
authored
75
76 ;;; mime
77 (setq gnus-mime-view-all-parts t
78 gnus-buttonized-mime-types nil
79 gnus-unbuttonized-mime-types '("text/plain"))
80 (setq mm-discouraged-alternatives '("text/html" "text/richtext"))
81
8b1aac0 @cofi [Emacs] Move to helm.
authored
82 (setq gnus-completing-read-function #'helm-completing-read-default)
919a2cc @cofi [Emacs] Add gnus config.
authored
83
2187a2d @cofi [Emacs] gnus: Add fun to copy archived at url.
authored
84 (defun cofi-gnus-copy-archived-at ()
85 "Copy archived-at url of current article to killring and clipboard."
86 (interactive)
87 (let ((archived (gnus-with-article-headers
88 (mail-extract-address-components
89 (mail-fetch-field "Archived-At")))))
90 (when archived
91 (let ((x-select-enable-clipboard t)
92 (field (second archived)))
93 (let ((url (if (not (begins-with field "http:"))
94 (concat "http:" (substring field 5))
95 field)))
96 (kill-new url)
97 (message "Copied: %s" url))))))
98
919a2cc @cofi [Emacs] Add gnus config.
authored
99 ;;; keys
100 (add-hook 'gnus-summary-mode-hook
b7ce382 @cofi [Emacs] Gnus: Add more keys for summary mode.
authored
101 (gen-local-fill-keymap-hook "M-p" 'gnus-summary-prev-article
102 "M-n" 'gnus-summary-next-article
103 "r" 'gnus-summary-wide-reply-with-original
104 "B d" 'gnus-summary-delete-article
105 "C-M-n" 'gnus-summary-next-thread
106 "C-M-p" 'gnus-summary-prev-thread
107 "A t" 'gnus-summary-refer-thread
108 "M-t" 'gnus-summary-refer-thread
2187a2d @cofi [Emacs] gnus: Add fun to copy archived at url.
authored
109 "y" 'cofi-gnus-copy-archived-at
110 "~" (cmd (gnus-summary-mark-article nil ?R))
b7ce382 @cofi [Emacs] Gnus: Add more keys for summary mode.
authored
111 ))
8eebf74 @cofi [Emacs] gnus: Require offlineimap because of modeline.
authored
112 (require 'offlineimap)
919a2cc @cofi [Emacs] Add gnus config.
authored
113 (add-hook 'gnus-group-mode-hook
114 (gen-local-fill-keymap-hook "<f12>" 'offlineimap))
115
116 (add-hook 'message-mode-hook
117 (gen-local-fill-keymap-hook "M-RET" 'yas/expand))
118
97bfc5a @cofi [Emacs] gnus: Modify citation line.
authored
119 (setq message-citation-line-function #'message-insert-formatted-citation-line)
120 (setq message-citation-line-format "On %a, %b %d %Y (%H:%M), %f wrote: \n")
121
919a2cc @cofi [Emacs] Add gnus config.
authored
122 (defun gnus-user-format-function-r (headers)
123 "Classify headers on how I'm adressed."
124 (let ((to (gnus-extra-header 'To headers))
125 (all (remove-duplicates (flatten
126 (mapcar (lambda (h)
127 (split-string (gnus-extra-header h headers)
128 ", " 'omit-nulls))
129 '(To Cc BCc)))
130 :test #'string=)))
131 (if (string-match user-mail-rx to)
132 (if (> (length all) 1)
133 ;; other recipients
134 "»"
135 ;; sole recipient
136 "!")
137 ;; unadressed
138 "-")))
139
140 ;;; scan for news every 10 minutes
d926922 @cofi [Emacs] gnus: Show Archived-At header.
authored
141 (setq gnus-visible-headers (concat gnus-visible-headers "\\|^Archived-At:"))
142
919a2cc @cofi [Emacs] Add gnus config.
authored
143 (gnus-demon-add-handler 'gnus-demon-scan-news 10 t)
144
145 (require-and-exec 'gnus-desktop-notify
96c0b09 @cofi [Emacs] `B d' to delete article.
authored
146 (setq gnus-desktop-notify-function (lambda (groups)
147 ;; set urgency hint on news
148 (x-urgency-hint (selected-frame) t)
149 (gnus-desktop-notify-send groups)))
919a2cc @cofi [Emacs] Add gnus config.
authored
150 (gnus-desktop-notify-mode))
Something went wrong with that request. Please try again.