-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmu4e-setup.el
233 lines (212 loc) · 9.42 KB
/
mu4e-setup.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
;==============================================================================
;
; mu4e configuration
;
;==============================================================================
(provide 'mu4e-setup)
(setq load-path (append '("/opt/homebrew/share/emacs/site-lisp/mu4e"
"/opt/homebrew/share/emacs/site-lisp/mu/mu4e"
"/usr/local/share/emacs/site-lisp/mu4e"
"/usr/local/share/emacs/site-lisp/mu/mu4e")
load-path))
(require 'mu4e)
(require 'mu4e-actions)
(setq mu4e-maildir "/Volumes/FourTea/Maildir/")
(setq mu4e-drafts-folder "/gmail/Drafts")
(setq mu4e-sent-folder "/gmail/Sent")
;; don't save message to Sent Messages, Gmail/IMAP takes care of this
(setq mu4e-sent-messages-behavior 'delete)
;; allow for updating mail using 'U' in the main view:
(setq mu4e-get-mail-command "mbsync -V all")
(setq message-citation-line-format "On %Y-%m-%d at %R %Z, %f wrote..."
message-citation-line-function 'message-insert-formatted-citation-line)
;; Fancy stuff (new)
(setq mu4e-use-fancy-chars t
mu4e-headers-draft-mark '("D" . "💈")
mu4e-headers-flagged-mark '("F" . "📍")
mu4e-headers-new-mark '("N" . "🔥")
mu4e-headers-passed-mark '("P" . "❯")
mu4e-headers-replied-mark '("R" . "❮")
mu4e-headers-seen-mark '("S" . "✅")
mu4e-headers-trashed-mark '("T" . "💀")
mu4e-headers-attach-mark '("a" . "📎")
mu4e-headers-encrypted-mark '("x" . "🔒")
mu4e-headers-signed-mark '("s" . "🔑")
mu4e-headers-unread-mark '("u" . "🥸")
mu4e-headers-list-mark '("s" . "🔈")
mu4e-headers-personal-mark '("p" . "👨")
mu4e-headers-calendar-mark '("c" . "📅"))
;; shortcuts
(setq mu4e-maildir-shortcuts
'( ("/blackbox/Inbox" . ?I)
("/blackbox/Sent" . ?S)
("/gmail/Inbox" . ?G)
("/gmail/Sent" . ?W)
("/rh/Act" . ?a)
("/rh/Act/Act Now" . ?n)
("/rh/Act/Keep" . ?k)
("/rh/Act/Review" . ?r)
("/rh/Act/Travel" . ?t)
("/rh/Inbox" . ?i)
("/rh/Sent" . ?s)
("/rh/Bugzillas" . ?b)
("/rh/Dev/Fedora notifications" . ?f)
("/rh/Dev/virt-devel" . ?v)
("/rh/Dev/qemu-devel" . ?q)
("/rh/WIP/Patches" . ?p)
("/rh/WIP/Pull" . ?l)
("/rh/WIP/RFC" . ?c)
))
;; something about ourselves
(setq
user-mail-address "[email protected]"
user-full-name "Christophe de Dinechin"
mu4e-compose-signature
(concat
"Cheers,\n"
"Christophe de Dinechin (https://c3d.github.io)\n"
"Freedom Covenant (https://github.com/c3d/freedom-covenant)\n"
"Theory of Incomplete Measurements (https://c3d.github.io/TIM)"))
;; show images
(setq mu4e-show-images t)
;; use imagemagick, if available
(when (fboundp 'imagemagick-register-types)
(imagemagick-register-types))
;; convert html emails properly
;; Possible options:
;; - html2text -utf8 -width 72
;; - textutil -stdin -format html -convert txt -stdout
;; - html2markdown | grep -v ' _place_holder;' (Requires html2text pypi)
;; - w3m -dump -cols 80 -T text/html
;; - view in browser (provided below)
;; (setq mu4e-html2text-command "textutil -stdin -format html -convert txt -stdout")
(setq mu4e-html2text-command
"w3m -dump -T text/html -O utf8 -cols 80 -o display_link_number=true")
;; spell check
(add-hook 'mu4e-compose-mode-hook
(defun ddd-mu4e-compose-stuff ()
"My settings for message composition."
(set-fill-column 76)
(flyspell-mode)))
;; add option to view html message in a browser
;; `aV` in view to activate
(add-to-list 'mu4e-view-actions
'("ViewInBrowser" . mu4e-action-view-in-browser) t)
(add-to-list 'mu4e-view-actions
'("Patch" . mu4e-action-git-apply-mbox) t)
;; define 'P' (the first letter of the description) as the shortcut
;; the 't' argument to add-to-list puts it at the end of the list
(add-to-list 'mu4e-headers-actions
'("Patch" . mu4e-action-git-apply-mbox) t)
;; Various common settings
(setq
mu4e-change-filenames-when-moving t ;; Required with mbsync
mu4e-update-interval 1521 ;; Roughly 25 minutes
mu4e-headers-skip-duplicates t ;; Don't record duplicates
mu4e-index-cleanup t ;; Do full cleanup check
mu4e-index-lazy-check nil ;; Don't rely on directory timestamps
mu4e-view-auto-mark-as-read t ;; Don't automatically mark mail as read
)
;------------------------------------------------------------------------------
;; configuration for sending mail
;------------------------------------------------------------------------------
(setq mu4e-sent-folder "/gmail/Sent"
mu4e-drafts-folder "/gmail/Drafts"
message-send-mail-function 'smtpmail-send-it
smtpmail-stream-type 'starttls
smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587)
(defvar mu4e-account-alist
'(("blackbox"
(mu4e-sent-folder "/blackbox/Sent")
(mu4e-drafts-folder "/blackbox/Drafts")
(user-mail-address "[email protected]")
(smtpmail-smtp-user "ddd")
(smtpmail-default-smtp-server "mail.dinechin.org")
(smtpmail-smtp-server "mail.dinechin.org")
(smtpmail-stream-type starttls)
(smtpmail-smtp-service 587)
(mu4e-sent-messages-behavior 'sent))
("gmail"
(mu4e-sent-folder "/gmail/Sent")
(mu4e-drafts-folder "/gmail/Drafts")
(user-mail-address "[email protected]")
(smtpmail-smtp-user "[email protected]")
(smtpmail-default-smtp-server "smtp.gmail.com")
(smtpmail-smtp-server "smtp.gmail.com")
(smtpmail-stream-type starttls)
(smtpmail-auth-credentials (expand-file-name "~/.authinfo.gpg"))
(smtpmail-smtp-service 587))
("rh"
(mu4e-sent-folder "/rh/Sent")
(mu4e-drafts-folder "/rh/Drafts")
(user-mail-address "[email protected]")
(smtpmail-smtp-user "cdupontd")
(smtpmail-default-smtp-server "smtp.corp.redhat.com")
(smtpmail-smtp-server "smtp.corp.redhat.com")
(smtpmail-stream-type starttls)
(smtpmail-smtp-service 587))))
(defun mu4e-set-account ()
"Set the account for composing a message."
(interactive)
(let* ((account
(if mu4e-compose-parent-message
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
(string-match "/\\(.*?\\)/" maildir)
(match-string 1 maildir))
(completing-read (format "Compose with account: (%s) "
(mapconcat #'(lambda (var) (car var))
mu4e-account-alist "/"))
(mapcar #'(lambda (var) (car var)) mu4e-account-alist)
nil t nil nil (caar mu4e-account-alist))))
(account-vars (cdr (assoc account mu4e-account-alist))))
(if account-vars
(mapc #'(lambda (var)
(set (car var) (cadr var)))
account-vars)
(error "No email account found"))))
(add-hook 'mu4e-compose-pre-hook 'mu4e-set-account)
(add-to-list 'mu4e-bookmarks
'(:name "Hot topics"
:query "NOT flag:trashed AND (subject:kata OR list:rh-kata-dev OR list:kata-dev OR subject:TDX OR subject:SEV OR subject:TDX OR subject:virtiofs)"
:key ?H))
(add-to-list 'mu4e-bookmarks
'(:name "Hot topics (unread)"
:query "NOT flag:trashed AND flag:unread AND (subject:kata OR list:rh-kata-dev OR list:kata-dev OR subject:TDX OR subject:SEV OR subject:TDX OR subject:virtiofs)"
:key ?h))
(add-to-list 'mu4e-bookmarks
'(:name "kvm"
:query "list:kvm*"
:key ?k))
(add-to-list 'mu4e-bookmarks
'(:name "qemu"
:query "list:qemu*"
:key ?q))
(add-to-list 'mu4e-bookmarks
'(:name "Flagged"
:query "flag:flagged"
:key ?f))
(add-to-list 'mu4e-bookmarks
'(:name "Virt"
:query "list:virt*"
:key ?v))
(add-to-list 'mu4e-bookmarks
'(:name "Work"
:query "list:virt* OR list:qemu* OR list:kvm* OR list:kata* OR subject:kata OR subject:qemu OR maildir:/Act"
:key ?o))
(add-to-list 'mu4e-bookmarks
'(:name "Just me"
:key ?j))
(setq mu4e-view-fields '(:from :to :cc :subject :flags :date :maildir
:mailing-list :tags :attachments
:signature :decryption :message-id)
mu4e-headers-fields '((:flags . 8)
(:human-date . 12)
;(:acctshortname . 4)
(:maildir . 15)
(:mailing-list . 15)
(:from-or-to . 25)
;(:size . 6)
(:subject . nil)))