[PATCH] emacs: More DWIM when editing messages

Dirk Hohndel hohndel at infradead.org
Mon Apr 26 09:31:49 PDT 2010


On Mon, 26 Apr 2010 15:01:25 +0100, David Edmondson <dme at dme.org> wrote:
> 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.

YES! Brilliant. I didn't realize how much I wanted it till you sent
this. Carl, please include in 0.3

/D

> ---
>  emacs/notmuch-mua.el |   32 +++++++++++++++++++-------------
>  1 files changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index bca20db..c7a9aee 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -98,21 +98,24 @@ list."
>  			      collect header)))
>      (message-sort-headers)
>      (message-hide-headers)
> -    (save-excursion
> -      (goto-char (point-max))
> -      (insert body))
> -    (set-buffer-modified-p nil)))
> +    (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 +129,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")
> -- 
> 1.7.0
> 
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

-- 
Dirk Hohndel
Intel Open Source Technology Center


More information about the notmuch mailing list