]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-mua.el
emacs: Sort headers when composing
[notmuch] / emacs / notmuch-mua.el
index acb7dbf0e2202e065e31e55a64c35bad3fbc05a3..fcdd2d14784727af51a8d16fc3b44eee5a4bb5c3 100644 (file)
              (setq headers (mail-header-extract)))))
       (forward-line 1)
       (setq body (buffer-substring (point) (point-max))))
-    (notmuch-mua-mail (mail-header 'to headers)
-                     (mail-header 'subject headers)
-                     (loop for header in headers
-                           if (not (or (eq 'to (car header))
-                                       (eq 'subject (car header))))
-                           collect header))
+    (let
+       ;; Overlay the composition window on that being used to read
+       ;; the original message.
+       ((same-window-regexps '("\\*mail .*")))
+      (notmuch-mua-mail (mail-header 'to headers)
+                       (mail-header 'subject headers)
+                       (loop for header in headers
+                             if (not (or (eq 'to (car header))
+                                         (eq 'subject (car header))))
+                             collect header)))
     (message-sort-headers)
     (message-hide-headers)
     (save-excursion
 
   (message-mail to subject other-headers continue
                switch-function yank-action send-actions)
+  (message-sort-headers)
   (message-hide-headers))
 
 (defun notmuch-mua-send-and-exit (&optional arg)