X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-mua.el;h=bd06e3cb29764c2cc4f46de96111a4da47db622e;hp=bca20db95168e86396c7946e10437f4c1bd95041;hb=80a90787163690d2d87571327ba504a470798c60;hpb=e2516a343b26737b53efdfbadc6ad01ab62975f7 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index bca20db9..bd06e3cb 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -98,21 +98,29 @@ list." collect header))) (message-sort-headers) (message-hide-headers) - (save-excursion - (goto-char (point-max)) - (insert body)) - (set-buffer-modified-p nil))) + ;; insert the message body - but put it in front of the signature + ;; if one is present + (goto-char (point-max)) + (if (re-search-backward message-signature-separator nil t) + (forward-line -1) + (goto-char (point-max))) + (insert body)) + (set-buffer-modified-p nil) + + (message-goto-body)) (defun notmuch-mua-forward-message () (message-forward) - (save-excursion - (when notmuch-mua-user-agent-function - (let ((user-agent (funcall notmuch-mua-user-agent-function))) - (when (not (string= "" user-agent)) - (message-add-header (format "User-Agent: %s" user-agent))))) - (message-sort-headers) - (message-hide-headers)) - (set-buffer-modified-p nil)) + + (when notmuch-mua-user-agent-function + (let ((user-agent (funcall notmuch-mua-user-agent-function))) + (when (not (string= "" user-agent)) + (message-add-header (format "User-Agent: %s" user-agent))))) + (message-sort-headers) + (message-hide-headers) + (set-buffer-modified-p nil) + + (message-goto-to)) (defun notmuch-mua-mail (&optional to subject other-headers continue switch-function yank-action send-actions) @@ -126,7 +134,10 @@ list." (message-mail to subject other-headers continue switch-function yank-action send-actions) (message-sort-headers) - (message-hide-headers)) + (message-hide-headers) + (set-buffer-modified-p nil) + + (message-goto-to)) (defun notmuch-mua-send-and-exit (&optional arg) (interactive "P")