]> git.notmuchmail.org Git - notmuch/blob - emacs/notmuch-mua.el
b68cdf2625ffafc8956d4c415ce9bcf920a0359e
[notmuch] / emacs / notmuch-mua.el
1 ;;; notmuch-mua.el --- emacs style mail-user-agent
2 ;;
3 ;; Copyright © David Edmondson
4 ;;
5 ;; This file is part of Notmuch.
6 ;;
7 ;; Notmuch is free software: you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
11 ;;
12 ;; Notmuch is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 ;; General Public License for more details.
16 ;;
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with Notmuch.  If not, see <https://www.gnu.org/licenses/>.
19 ;;
20 ;; Authors: David Edmondson <dme@dme.org>
21
22 ;;; Code:
23
24 (require 'message)
25 (require 'mm-view)
26 (require 'format-spec)
27
28 (require 'notmuch-lib)
29 (require 'notmuch-address)
30
31 (eval-when-compile (require 'cl))
32
33 (declare-function notmuch-show-insert-body "notmuch-show" (msg body depth))
34 (declare-function notmuch-fcc-header-setup "notmuch-maildir-fcc" ())
35 (declare-function notmuch-maildir-message-do-fcc "notmuch-maildir-fcc" ())
36 (declare-function notmuch-draft-postpone "notmuch-draft" ())
37 (declare-function notmuch-draft-save "notmuch-draft" ())
38
39 ;;
40
41 (defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
42   "Hook run before sending messages."
43   :type 'hook
44   :group 'notmuch-send
45   :group 'notmuch-hooks)
46
47 (defcustom notmuch-mua-compose-in 'current-window
48   (concat
49    "Where to create the mail buffer used to compose a new message.
50 Possible values are `current-window' (default), `new-window' and
51 `new-frame'. If set to `current-window', the mail buffer will be
52 displayed in the current window, so the old buffer will be
53 restored when the mail buffer is killed. If set to `new-window'
54 or `new-frame', the mail buffer will be displayed in a new
55 window/frame that will be destroyed when the buffer is killed.
56 You may want to customize `message-kill-buffer-on-exit'
57 accordingly."
58    (when (< emacs-major-version 24)
59            " Due to a known bug in Emacs 23, you should not set
60 this to `new-window' if `message-kill-buffer-on-exit' is
61 disabled: this would result in an incorrect behavior."))
62   :group 'notmuch-send
63   :type '(choice (const :tag "Compose in the current window" current-window)
64                  (const :tag "Compose mail in a new window"  new-window)
65                  (const :tag "Compose mail in a new frame"   new-frame)))
66
67 (defcustom notmuch-mua-user-agent-function nil
68   "Function used to generate a `User-Agent:' string. If this is
69 `nil' then no `User-Agent:' will be generated."
70   :type '(choice (const :tag "No user agent string" nil)
71                  (const :tag "Full" notmuch-mua-user-agent-full)
72                  (const :tag "Notmuch" notmuch-mua-user-agent-notmuch)
73                  (const :tag "Emacs" notmuch-mua-user-agent-emacs)
74                  (function :tag "Custom user agent function"
75                            :value notmuch-mua-user-agent-full))
76   :group 'notmuch-send)
77
78 (defcustom notmuch-mua-hidden-headers nil
79   "Headers that are added to the `message-mode' hidden headers
80 list."
81   :type '(repeat string)
82   :group 'notmuch-send)
83
84 (defgroup notmuch-reply nil
85   "Replying to messages in notmuch"
86   :group 'notmuch)
87
88 (defcustom notmuch-mua-cite-function 'message-cite-original
89   "*Function for citing an original message.
90 Predefined functions include `message-cite-original' and
91 `message-cite-original-without-signature'.
92 Note that these functions use `mail-citation-hook' if that is non-nil."
93   :type '(radio (function-item message-cite-original)
94                 (function-item message-cite-original-without-signature)
95                 (function-item sc-cite-original)
96                 (function :tag "Other"))
97   :link '(custom-manual "(message)Insertion Variables")
98   :group 'notmuch-reply)
99
100 (defcustom notmuch-mua-reply-insert-header-p-function
101   'notmuch-show-reply-insert-header-p-never
102   "Function to decide which parts get a header when replying.
103
104 This function specifies which parts of a mime message with
105 mutiple parts get a header."
106   :type '(radio (const :tag "No part headers"
107                                notmuch-show-reply-insert-header-p-never)
108                 (const :tag "All except multipart/* and hidden parts"
109                                notmuch-show-reply-insert-header-p-trimmed)
110                 (const :tag "Only for included text parts"
111                                notmuch-show-reply-insert-header-p-minimal)
112                 (const :tag "Exactly as in show view"
113                                notmuch-show-insert-header-p)
114                 (function :tag "Other"))
115   :group 'notmuch-reply)
116
117 ;;
118
119 (defun notmuch-mua-get-switch-function ()
120   "Get a switch function according to `notmuch-mua-compose-in'."
121   (cond ((eq notmuch-mua-compose-in 'current-window)
122          'switch-to-buffer)
123         ((eq notmuch-mua-compose-in 'new-window)
124          'switch-to-buffer-other-window)
125         ((eq notmuch-mua-compose-in 'new-frame)
126          'switch-to-buffer-other-frame)
127         (t (error "Invalid value for `notmuch-mua-compose-in'"))))
128
129 (defun notmuch-mua-maybe-set-window-dedicated ()
130   "Set the selected window as dedicated according to
131 `notmuch-mua-compose-in'."
132   (when (or (eq notmuch-mua-compose-in 'new-frame)
133             (eq notmuch-mua-compose-in 'new-window))
134     (set-window-dedicated-p (selected-window) t)))
135
136 (defun notmuch-mua-user-agent-full ()
137   "Generate a `User-Agent:' string suitable for notmuch."
138   (concat (notmuch-mua-user-agent-notmuch)
139           " "
140           (notmuch-mua-user-agent-emacs)))
141
142 (defun notmuch-mua-user-agent-notmuch ()
143   "Generate a `User-Agent:' string suitable for notmuch."
144   (let ((notmuch-version (if (string= notmuch-emacs-version "unknown")
145                              (notmuch-cli-version)
146                            notmuch-emacs-version)))
147     (concat "Notmuch/" notmuch-version " (https://notmuchmail.org)")))
148
149 (defun notmuch-mua-user-agent-emacs ()
150   "Generate a `User-Agent:' string suitable for notmuch."
151   (concat "Emacs/" emacs-version " (" system-configuration ")"))
152
153 (defun notmuch-mua-add-more-hidden-headers ()
154   "Add some headers to the list that are hidden by default."
155   (mapc (lambda (header)
156           (when (not (member header message-hidden-headers))
157             (push header message-hidden-headers)))
158         notmuch-mua-hidden-headers))
159
160 (defun notmuch-mua-reply-crypto (parts)
161   "Add mml sign-encrypt flag if any part of original message is encrypted."
162   (loop for part in parts
163         if (notmuch-match-content-type (plist-get part :content-type) "multipart/encrypted")
164           do (mml-secure-message-sign-encrypt)
165         else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
166           do (notmuch-mua-reply-crypto (plist-get part :content))))
167
168 ;; There is a bug in emacs 23's message.el that results in a newline
169 ;; not being inserted after the References header, so the next header
170 ;; is concatenated to the end of it. This function fixes the problem,
171 ;; while guarding against the possibility that some current or future
172 ;; version of emacs has the bug fixed.
173 (defun notmuch-mua-insert-references (original-func header references)
174   (funcall original-func header references)
175   (unless (bolp) (insert "\n")))
176
177 (defun notmuch-mua-reply (query-string &optional sender reply-all)
178   (let ((args '("reply" "--format=sexp" "--format-version=1"))
179         (process-crypto notmuch-show-process-crypto)
180         reply
181         original)
182     (when process-crypto
183       (setq args (append args '("--decrypt"))))
184
185     (if reply-all
186         (setq args (append args '("--reply-to=all")))
187       (setq args (append args '("--reply-to=sender"))))
188     (setq args (append args (list query-string)))
189
190     ;; Get the reply object as SEXP, and parse it into an elisp object.
191     (setq reply (apply #'notmuch-call-notmuch-sexp args))
192
193     ;; Extract the original message to simplify the following code.
194     (setq original (plist-get reply :original))
195
196     ;; Extract the headers of both the reply and the original message.
197     (let* ((original-headers (plist-get original :headers))
198            (reply-headers (plist-get reply :reply-headers)))
199
200       ;; If sender is non-nil, set the From: header to its value.
201       (when sender
202         (plist-put reply-headers :From sender))
203       (let
204           ;; Overlay the composition window on that being used to read
205           ;; the original message.
206           ((same-window-regexps '("\\*mail .*")))
207
208         ;; We modify message-header-format-alist to get around a bug in message.el.
209         ;; See the comment above on notmuch-mua-insert-references.
210         (let ((message-header-format-alist
211                (loop for pair in message-header-format-alist
212                      if (eq (car pair) 'References)
213                      collect (cons 'References
214                                    (apply-partially
215                                     'notmuch-mua-insert-references
216                                     (cdr pair)))
217                      else
218                      collect pair)))
219           (notmuch-mua-mail (plist-get reply-headers :To)
220                             (plist-get reply-headers :Subject)
221                             (notmuch-headers-plist-to-alist reply-headers)
222                             nil (notmuch-mua-get-switch-function))))
223
224       ;; Insert the message body - but put it in front of the signature
225       ;; if one is present, and after any other content
226       ;; message*setup-hooks may have added to the message body already.
227       (save-restriction
228         (message-goto-body)
229         (narrow-to-region (point) (point-max))
230         (goto-char (point-max))
231         (if (re-search-backward message-signature-separator nil t)
232             (if message-signature-insert-empty-line
233                 (forward-line -1))
234           (goto-char (point-max))))
235
236       (let ((from (plist-get original-headers :From))
237             (date (plist-get original-headers :Date))
238             (start (point)))
239
240         ;; notmuch-mua-cite-function constructs a citation line based
241         ;; on the From and Date headers of the original message, which
242         ;; are assumed to be in the buffer.
243         (insert "From: " from "\n")
244         (insert "Date: " date "\n\n")
245
246         (insert (with-temp-buffer
247                   (let
248                       ;; Don't attempt to clean up messages, excerpt
249                       ;; citations, etc. in the original message before
250                       ;; quoting.
251                       ((notmuch-show-insert-text/plain-hook nil)
252                        ;; Don't omit long parts.
253                        (notmuch-show-max-text-part-size 0)
254                        ;; Insert headers for parts as appropriate for replying.
255                        (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function)
256                        ;; Ensure that any encrypted parts are
257                        ;; decrypted during the generation of the reply
258                        ;; text.
259                        (notmuch-show-process-crypto process-crypto)
260                        ;; Don't indent multipart sub-parts.
261                        (notmuch-show-indent-multipart nil))
262                     ;; We don't want sigstatus buttons (an information leak and usually wrong anyway).
263                     (letf (((symbol-function 'notmuch-crypto-insert-sigstatus-button) #'ignore)
264                            ((symbol-function 'notmuch-crypto-insert-encstatus-button) #'ignore))
265                           (notmuch-show-insert-body original (plist-get original :body) 0)
266                           (buffer-substring-no-properties (point-min) (point-max))))))
267
268         (set-mark (point))
269         (goto-char start)
270         ;; Quote the original message according to the user's configured style.
271         (funcall notmuch-mua-cite-function)))
272
273     ;; Crypto processing based crypto content of the original message
274     (when process-crypto
275       (notmuch-mua-reply-crypto (plist-get original :body))))
276
277   ;; Push mark right before signature, if any.
278   (message-goto-signature)
279   (unless (eobp)
280     (end-of-line -1))
281   (push-mark)
282
283   (message-goto-body)
284   (set-buffer-modified-p nil))
285
286 (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]"
287   "Notmuch message composition mode. Mostly like `message-mode'"
288   (notmuch-address-setup))
289
290 (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify)
291
292 (define-key notmuch-message-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)
293 (define-key notmuch-message-mode-map (kbd "C-c C-s") #'notmuch-mua-send)
294 (define-key notmuch-message-mode-map (kbd "C-c C-p") #'notmuch-draft-postpone)
295 (define-key notmuch-message-mode-map (kbd "C-x C-s") #'notmuch-draft-save)
296
297 (defun notmuch-mua-pop-to-buffer (name switch-function)
298   "Pop to buffer NAME, and warn if it already exists and is
299 modified. This function is notmuch addaptation of
300 `message-pop-to-buffer'."
301   (let ((buffer (get-buffer name)))
302     (if (and buffer
303              (buffer-name buffer))
304         (let ((window (get-buffer-window buffer 0)))
305           (if window
306               ;; Raise the frame already displaying the message buffer.
307               (progn
308                 (gnus-select-frame-set-input-focus (window-frame window))
309                 (select-window window))
310             (funcall switch-function buffer)
311             (set-buffer buffer))
312           (when (and (buffer-modified-p)
313                      (not (prog1
314                               (y-or-n-p
315                                "Message already being composed; erase? ")
316                             (message nil))))
317             (error "Message being composed")))
318       (funcall switch-function name)
319       (set-buffer name))
320     (erase-buffer)
321     (notmuch-message-mode)))
322
323 (defun notmuch-mua-mail (&optional to subject other-headers continue
324                                    switch-function yank-action send-actions
325                                    return-action &rest ignored)
326   "Invoke the notmuch mail composition window."
327   (interactive)
328
329   (when notmuch-mua-user-agent-function
330     (let ((user-agent (funcall notmuch-mua-user-agent-function)))
331       (when (not (string= "" user-agent))
332         (push (cons 'User-Agent user-agent) other-headers))))
333
334   (unless (assq 'From other-headers)
335     (push (cons 'From (message-make-from
336                        (notmuch-user-name) (notmuch-user-primary-email))) other-headers))
337
338   (notmuch-mua-pop-to-buffer (message-buffer-name "mail" to)
339                              (or switch-function (notmuch-mua-get-switch-function)))
340   (let ((headers
341          (append
342           ;; The following is copied from `message-mail'
343           `((To . ,(or to "")) (Subject . ,(or subject "")))
344           ;; C-h f compose-mail says that headers should be specified as
345           ;; (string . value); however all the rest of message expects
346           ;; headers to be symbols, not strings (eg message-header-format-alist).
347           ;; https://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00337.html
348           ;; We need to convert any string input, eg from rmail-start-mail.
349           (dolist (h other-headers other-headers)
350             (if (stringp (car h)) (setcar h (intern (capitalize (car h))))))))
351         (args (list yank-action send-actions))
352         ;; Cause `message-setup-1' to do things relevant for mail,
353         ;; such as observe `message-default-mail-headers'.
354         (message-this-is-mail t))
355     ;; message-setup-1 in Emacs 23 does not accept return-action
356     ;; argument. Pass it only if it is supplied by the caller. This
357     ;; will never be the case when we're called by `compose-mail' in
358     ;; Emacs 23.
359     (when return-action (nconc args '(return-action)))
360     (apply 'message-setup-1 headers args))
361   (notmuch-fcc-header-setup)
362   (message-sort-headers)
363   (message-hide-headers)
364   (set-buffer-modified-p nil)
365   (notmuch-mua-maybe-set-window-dedicated)
366
367   (message-goto-to))
368
369 (defcustom notmuch-identities nil
370   "Identities that can be used as the From: address when composing a new message.
371
372 If this variable is left unset, then a list will be constructed from the
373 name and addresses configured in the notmuch configuration file."
374   :type '(repeat string)
375   :group 'notmuch-send)
376
377 (defcustom notmuch-always-prompt-for-sender nil
378   "Always prompt for the From: address when composing or forwarding a message.
379
380 This is not taken into account when replying to a message, because in that case
381 the From: header is already filled in by notmuch."
382   :type 'boolean
383   :group 'notmuch-send)
384
385 (defvar notmuch-mua-sender-history nil)
386
387 ;; Workaround: Running `ido-completing-read' in emacs 23.1, 23.2 and 23.3
388 ;; without some explicit initialization fill freeze the operation.
389 ;; Hence, we advice `ido-completing-read' to ensure required initialization
390 ;; is done.
391 (if (and (= emacs-major-version 23) (< emacs-minor-version 4))
392     (defadvice ido-completing-read (before notmuch-ido-mode-init activate)
393       (ido-init-completion-maps)
394       (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
395       (add-hook 'choose-completion-string-functions
396                 'ido-choose-completion-string)
397       (ad-disable-advice 'ido-completing-read 'before 'notmuch-ido-mode-init)
398       (ad-activate 'ido-completing-read)))
399
400 (defun notmuch-mua-prompt-for-sender ()
401   "Prompt for a sender from the user's configured identities."
402   (if notmuch-identities
403       (ido-completing-read "Send mail from: " notmuch-identities
404                            nil nil nil 'notmuch-mua-sender-history
405                            (car notmuch-identities))
406     (let* ((name (notmuch-user-name))
407            (addrs (cons (notmuch-user-primary-email)
408                         (notmuch-user-other-email)))
409            (address
410             (ido-completing-read (concat "Sender address for " name ": ") addrs
411                                  nil nil nil 'notmuch-mua-sender-history
412                                  (car addrs))))
413       (message-make-from name address))))
414
415 (put 'notmuch-mua-new-mail 'notmuch-prefix-doc "... and prompt for sender")
416 (defun notmuch-mua-new-mail (&optional prompt-for-sender)
417   "Compose new mail.
418
419 If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
420 the From: address first."
421   (interactive "P")
422   (let ((other-headers
423          (when (or prompt-for-sender notmuch-always-prompt-for-sender)
424            (list (cons 'From (notmuch-mua-prompt-for-sender))))))
425     (notmuch-mua-mail nil nil other-headers nil (notmuch-mua-get-switch-function))))
426
427 (defun notmuch-mua-new-forward-messages (messages &optional prompt-for-sender)
428   "Compose a new message forwarding MESSAGES.
429
430 If PROMPT-FOR-SENDER is non-nil, the user will be prompteed for
431 the From: address."
432   (let* ((other-headers
433           (when (or prompt-for-sender notmuch-always-prompt-for-sender)
434             (list (cons 'From (notmuch-mua-prompt-for-sender)))))
435          forward-subject) ;; Comes from the first message and is
436                           ;; applied later.
437
438     ;; Generate the template for the outgoing message.
439     (notmuch-mua-mail nil "" other-headers nil (notmuch-mua-get-switch-function))
440
441     (save-excursion
442       ;; Insert all of the forwarded messages.
443       (mapc (lambda (id)
444               (let ((temp-buffer (get-buffer-create
445                                   (concat "*notmuch-fwd-raw-" id "*"))))
446                 ;; Get the raw version of this message in the buffer.
447                 (with-current-buffer temp-buffer
448                   (erase-buffer)
449                   (let ((coding-system-for-read 'no-conversion))
450                     (call-process notmuch-command nil t nil "show" "--format=raw" id))
451                   ;; Because we process the messages in reverse order,
452                   ;; always generate a forwarded subject, then use the
453                   ;; last (i.e. first) one.
454                   (setq forward-subject (message-make-forward-subject)))
455                 ;; Make a copy ready to be forwarded in the
456                 ;; composition buffer.
457                 (message-forward-make-body temp-buffer)
458                 ;; Kill the temporary buffer.
459                 (kill-buffer temp-buffer)))
460             ;; `message-forward-make-body' always puts the message at
461             ;; the top, so do them in reverse order.
462             (reverse messages))
463
464       ;; Add in the appropriate subject.
465       (save-restriction
466         (message-narrow-to-headers)
467         (message-remove-header "Subject")
468         (message-add-header (concat "Subject: " forward-subject)))
469
470       ;; `message-forward-make-body' shows the User-agent header.  Hide
471       ;; it again.
472       (message-hide-headers)
473       (set-buffer-modified-p nil))))
474
475 (defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all)
476   "Compose a reply to the message identified by QUERY-STRING.
477
478 If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
479 the From: address first.  If REPLY-ALL is non-nil, the message
480 will be addressed to all recipients of the source message."
481
482 ;; In current emacs (24.3) select-active-regions is set to t by
483 ;; default. The reply insertion code sets the region to the quoted
484 ;; message to make it easy to delete (kill-region or C-w). These two
485 ;; things combine to put the quoted message in the primary selection.
486 ;;
487 ;; This is not what the user wanted and is a privacy risk (accidental
488 ;; pasting of the quoted message). We can avoid some of the problems
489 ;; by let-binding select-active-regions to nil. This fixes if the
490 ;; primary selection was previously in a non-emacs window but not if
491 ;; it was in an emacs window. To avoid the problem in the latter case
492 ;; we deactivate mark.
493
494   (let ((sender
495          (when prompt-for-sender
496            (notmuch-mua-prompt-for-sender)))
497         (select-active-regions nil))
498     (notmuch-mua-reply query-string sender reply-all)
499     (deactivate-mark)))
500
501 (defun notmuch-mua-check-no-misplaced-secure-tag ()
502   "Query user if there is a misplaced secure mml tag.
503
504 Emacs message-send will (probably) ignore a secure mml tag unless
505 it is at the start of the body. Returns t if there is no such
506 tag, or the user confirms they mean it."
507   (save-excursion
508     (let ((body-start (progn (message-goto-body) (point))))
509       (goto-char (point-max))
510       (or
511        ;; We are always fine if there is no secure tag.
512        (not (search-backward "<#secure" nil 't))
513        ;; There is a secure tag, so it must be at the start of the
514        ;; body, with no secure tag earlier (i.e., in the headers).
515        (and (= (point) body-start)
516             (not (search-backward "<#secure" nil 't)))
517        ;; The user confirms they means it.
518        (yes-or-no-p "\
519 There is a <#secure> tag not at the start of the body. It is
520 likely that the message will be sent unsigned and unencrypted.
521 Really send? ")))))
522
523 (defun notmuch-mua-check-secure-tag-has-newline ()
524   "Query if the secure mml tag has a newline following it.
525
526 Emacs message-send will (probably) ignore a correctly placed
527 secure mml tag unless it is followed by a newline. Returns t if
528 any secure tag is followed by a newline, or the user confirms
529 they mean it."
530   (save-excursion
531     (message-goto-body)
532     (or
533      ;; There is no (correctly placed) secure tag.
534      (not (looking-at "<#secure"))
535      ;; The secure tag is followed by a newline.
536      (looking-at "<#secure[^\n>]*>\n")
537      ;; The user confirms they means it.
538      (yes-or-no-p "\
539 The <#secure> tag at the start of the body is not followed by a
540 newline. It is likely that the message will be sent unsigned and
541 unencrypted.  Really send? "))))
542
543 (defun notmuch-mua-send-common (arg &optional exit)
544   (interactive "P")
545   (when (and (notmuch-mua-check-no-misplaced-secure-tag)
546              (notmuch-mua-check-secure-tag-has-newline))
547     (letf (((symbol-function 'message-do-fcc) #'notmuch-maildir-message-do-fcc))
548           (if exit
549               (message-send-and-exit arg)
550             (message-send arg)))))
551
552 (defun notmuch-mua-send-and-exit (&optional arg)
553   (interactive "P")
554   (notmuch-mua-send-common arg 't))
555
556 (defun notmuch-mua-send (&optional arg)
557   (interactive "P")
558   (notmuch-mua-send-common arg))
559
560 (defun notmuch-mua-kill-buffer ()
561   (interactive)
562   (message-kill-buffer))
563
564 (defun notmuch-mua-message-send-hook ()
565   "The default function used for `notmuch-mua-send-hook', this
566 simply runs the corresponding `message-mode' hook functions."
567   (run-hooks 'message-send-hook))
568
569 ;;
570
571 (define-mail-user-agent 'notmuch-user-agent
572   'notmuch-mua-mail 'notmuch-mua-send-and-exit
573   'notmuch-mua-kill-buffer 'notmuch-mua-send-hook)
574
575 ;; Add some more headers to the list that `message-mode' hides when
576 ;; composing a message.
577 (notmuch-mua-add-more-hidden-headers)
578
579 ;;
580
581 (provide 'notmuch-mua)
582
583 ;;; notmuch-mua.el ends here