forked from mohsenil85/emacs-tv-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gnus.el
271 lines (225 loc) · 8.39 KB
/
.gnus.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
;;; .gnus.el -- Laptop
;;; Code:
;;; Search engine for imap and gmane (hit `G G' in group buffer)
;;
(require 'nnir)
(require 'cl-lib)
;; Don't read/write to the .newrc file, go straight to the *.eld.
(setq gnus-save-newsrc-file nil
gnus-read-newsrc-file nil)
(setq gnus-read-active-file 'some)
(setq gnus-check-new-newsgroups 'ask-server)
;;; Gnus methods
;;
;;
;; Default method
(setq gnus-select-method '(nntp "news.gmane.org"
(nnir-search-engine gmane)))
;;; To add a mail account:
;;
;; 1) Add an nnimap entry in `gnus-secondary-select-methods'.
;; 2) Add an entry in `gnus-posting-styles'
;; 3) Add an entry in `tv-smtp-accounts'
;; 4) Add an entries in authinfo for imap and smtp refering to labels. (See below)
;; Secondary methods are mails and possibly other nntp servers.
(setq gnus-secondary-select-methods '((nnml "")
;; Add as many gmail account as needed with a label.
;; Add then an entry in .authinfo:
;; machine label port xxx login xxx password xxx
;; (nnimap "gmail" ; Label for reference in .authinfo for machine name.
;; (nnimap-address "imap.gmail.com")
;; (nnimap-fetch-partial-articles "text/"))
;; ;;[1]
;; (nnimap "yahoo"
;; (nnimap-address "imap.mail.yahoo.com")
;; (nnimap-fetch-partial-articles "text/"))
;; [1]
;(nntp "news.gwene.org")
))
;; [1] Don't load mime parts when receiving mail, only text part.
;; Use `A-C' to see entire mail.
;; Nnml mail directory
(setq nnml-directory "~/Mail")
;;; Archivage des mails envoyés
;;
(setq gnus-message-archive-group '((when (message-news-p) "sent-news")))
;;; Show all these headers
;;
;;
(setq gnus-visible-headers
'("^From:"
"^Newsgroups:"
"^Subject:"
"^Date:"
"^Followup-To:"
"^Reply-To:"
"^Organization:"
"^Summary:"
"^Keywords:"
"^To:"
"^[BGF]?Cc:"
"^Posted-To:"
"^Mail-Copies-To:"
"^Apparently-To:"
"^X-Gnus-Warning:"
"^Resent-From:"
"^X-Sent:"
"^X-Mailer:"
"^X-Newsreader:"
"^X-User-Agent:"
"^User-Agent:"))
;;; Order of headers
;;
;;
(setq gnus-sorted-header-list '("^From:"
"^Subject:"
"^Summary:"
"^Keywords:"
"^Newsgroups:"
"^Followup-To:"
"^To:"
"^Cc:"
"^Date:"
"^User-Agent:"
"^X-Mailer:"
"^X-Newsreader:"))
(setq gnus-buttonized-mime-types
'("multipart/alternative"
".*/signed"
"multipart/encrypted"))
;; timestamp
(add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
(setq gnus-group-line-format "%M\%S\%p\%P\%5y: %(%-40,40g%) %ud\n")
(defun gnus-user-format-function-d (headers)
(declare (special gnus-tmp-group))
(let ((time (gnus-group-timestamp gnus-tmp-group)))
(if time (format-time-string "%b %d %H:%M" time) "")))
(setq gnus-summary-line-format "%U%R%z %(%&user-date; %-15,15f %* %B%s%)\n"
gnus-user-date-format-alist '((t . "%d.%m.%Y %H:%M"))
gnus-sum-thread-tree-false-root ""
gnus-sum-thread-tree-indent " "
gnus-sum-thread-tree-root ""
gnus-sum-thread-tree-leaf-with-other "├► "
gnus-sum-thread-tree-single-leaf "╰► "
gnus-sum-thread-tree-vertical "│")
;; Gravatar
;(setq gnus-treat-from-gravatar 'head) ; in From header
;(setq gnus-treat-mail-gravatar 'head) ; in To/Cc header
;; Integration dans dired
(require 'gnus-dired)
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
;; fortune
(add-hook 'gnus-article-mode-hook
#'(lambda ()
(define-key gnus-article-mode-map "i" 'fortune-from-region)))
;; (add-hook 'message-setup-hook 'fortune-to-signature)
;; (message "Making new signature: %s" (fortune-to-signature "~/docs/ascii/misc/fortunes/usenet"))
;; Scoring
;; The scoring system sorts articles and authors you read often to the beginning of the available mails.
;; Less interesting stuff is located at the end.
(setq gnus-use-adaptive-scoring t)
(setq gnus-score-expiry-days 14)
(setq gnus-default-adaptive-score-alist
'((gnus-unread-mark)
(gnus-ticked-mark (from 4))
(gnus-dormant-mark (from 5))
(gnus-saved-mark (from 20) (subject 5))
(gnus-del-mark (from -2) (subject -5))
(gnus-read-mark (from 2) (subject 1))
(gnus-killed-mark (from 0) (subject -3))))
(setq gnus-score-decay-constant 1) ;default = 3
(setq gnus-score-decay-scale 0.03) ;default = 0.05
(setq gnus-decay-scores t) ;(gnus-decay-score 1000)
;; Use a global score file to filter gmane spam articles.
(setq gnus-global-score-files
'("~/News/scores/all.SCORE"))
;; all.SCORE contains:
;; (("xref"
;; ("gmane.spam.detected" -1000 nil s)))
(setq gnus-summary-expunge-below -999)
;;; Message and smtp settings
;;
;;
;; Don't send to these address in wide reply.
(setq message-dont-reply-to-names '("notifications@github\\.com"
".*@noreply\\.github\\.com"
"thierry\\.volpiatto@gmail\\.com"))
(setq user-mail-address "[email protected]")
(setq user-full-name "Thierry Volpiatto")
;; [smtpmail-async] Experimental, use `smtpmail-send-it' otherwise.
(setq message-send-mail-function 'async-smtpmail-send-it
;smtpmail-debug-info t ; Uncomment to debug
;smtpmail-debug-verb t ; Uncomment to debug on server
mail-specify-envelope-from t ; Use from field to specify sender name.
mail-envelope-from 'header) ; otherwise `user-mail-address' is used.
;; Default settings.
;; This are default setting, they could be modified
;; by `tv-change-smtp-server' according to `tv-smtp-accounts'
;; and `gnus-posting-styles'.
(setq smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-smtp-user user-mail-address
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587)
;; Passage à la ligne automatique
;;
(defun tv/message-mode-setup ()
(setq fill-column 72)
(turn-on-auto-fill)
(epa-mail-mode 1))
(add-hook 'message-mode-hook 'tv/message-mode-setup)
;; Ne pas demander si on splitte les pa
(setq message-send-mail-partially-limit nil)
;;; mm-* settings
;;
;; Junk mail
(when (require 'mm-decode)
(setq mm-discouraged-alternatives
'("text/html"
"text/richtext"
"text/enriched"
"multipart/related"
"image/.*")
mm-automatic-display
(remove "text/html" mm-automatic-display)))
;;; Remove white space in filenames
;;
;;
(setq mm-file-name-rewrite-functions
'(mm-file-name-delete-control
mm-file-name-delete-gotchas
mm-file-name-trim-whitespace
mm-file-name-collapse-whitespace
mm-file-name-replace-whitespace))
;; Html renderer
(cond ((fboundp 'w3m)
;; Emacs-w3m
(setq mm-text-html-renderer 'w3m))
((executable-find "w3m")
;; W3m (Don't need emacs-w3m)
(setq mm-text-html-renderer 'w3m-standalone))
(t ; Fall back to shr.
(setq shr-color-visible-luminance-min 75)
(setq shr-width nil) ; Use all window width.
(setq mm-text-html-renderer 'shr)))
;; Try to inline images
(setq mm-inline-text-html-with-images t)
;;; Mail encryption.
;;
;;
(setq mml2015-use 'epg)
(setq mml2015-encrypt-to-self t)
;; Verify/Decrypt automatically
;; only if mml knows about the protocol used.
(setq mm-verify-option 'known)
(setq mm-decrypt-option 'known)
(setq gnus-inhibit-mime-unbuttonizing nil)
(setq gnus-buttonized-mime-types '("multipart/signed"
"multipart/alternative"))
;; Automatically sign/encrypt replies to signed/encrypted mails.
(setq gnus-message-replysign t)
(setq gnus-message-replyencrypt t)
;; Suppression de la signature quand on quote.
(setq message-cite-function 'message-cite-original-without-signature)
;; Default directory to save attached files
(setq mm-default-directory "~/download/")
;;; .gnus.el ends here