emacs: More DWIM when editing messages

For composing new messages and forwarding, leave the cursor on the
'To:' field. For replies, leave the cursor at the start of the
body. In all cases, mark the buffer as not modified so that the user
is not prompted if she decides to immediately kill the buffer.
This commit is contained in:
David Edmondson 2010-04-26 15:01:25 +01:00 committed by Carl Worth
parent 01ec4d3bcb
commit e247ae47c1

View file

@ -98,21 +98,24 @@ list."
collect header))) collect header)))
(message-sort-headers) (message-sort-headers)
(message-hide-headers) (message-hide-headers)
(save-excursion (goto-char (point-max))
(goto-char (point-max)) (insert body))
(insert body)) (set-buffer-modified-p nil)
(set-buffer-modified-p nil)))
(message-goto-body))
(defun notmuch-mua-forward-message () (defun notmuch-mua-forward-message ()
(message-forward) (message-forward)
(save-excursion
(when notmuch-mua-user-agent-function (when notmuch-mua-user-agent-function
(let ((user-agent (funcall notmuch-mua-user-agent-function))) (let ((user-agent (funcall notmuch-mua-user-agent-function)))
(when (not (string= "" user-agent)) (when (not (string= "" user-agent))
(message-add-header (format "User-Agent: %s" user-agent))))) (message-add-header (format "User-Agent: %s" user-agent)))))
(message-sort-headers) (message-sort-headers)
(message-hide-headers)) (message-hide-headers)
(set-buffer-modified-p nil)) (set-buffer-modified-p nil)
(message-goto-to))
(defun notmuch-mua-mail (&optional to subject other-headers continue (defun notmuch-mua-mail (&optional to subject other-headers continue
switch-function yank-action send-actions) switch-function yank-action send-actions)
@ -126,7 +129,10 @@ list."
(message-mail to subject other-headers continue (message-mail to subject other-headers continue
switch-function yank-action send-actions) switch-function yank-action send-actions)
(message-sort-headers) (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) (defun notmuch-mua-send-and-exit (&optional arg)
(interactive "P") (interactive "P")