[PATCH 1/1] emacs: fix notmuch-mua-reply point placement when signature involved

Mark Walters markwalters1009 at gmail.com
Fri Sep 6 10:16:11 PDT 2013


This LGTM +1

Mark

On Fri, 06 Sep 2013, Tomi Ollila <tomi.ollila at iki.fi> wrote:
> When composing a reply, notmuch-mua-reply attempts to  cite the
> the original message by inserting it before the user signature, if
> one is present. The existing method used to search the signature
> separator backward from the end of the buffer and then move one
> line up. In case of variable `message-signature-insert-empty-line'
> being nil this caused point to go to the beginning of
> '--text follows this line--'
> separator line, and citation was inserted there.
> This change checks the value of `message-signature-insert-empty-line'
> and doesn't move point if that is nil. Additional narrowing to
> the body region ensures that point never goes to the separator line
> (or beyond).
> `message-signature-setup-hook' or `message-setup-hook' may already have
> added some other content to the message body, therefore using simply
> (message-goto-body) to move point to the beginning of body might lead
> to unexpected results.
>
> Original patch from "Geoffrey H. Ferrari", continued with iterations
> from Jani and Mark.
> ---
>
> This is update to
>
> id:1378322458-30159-1-git-send-email-tomi.ollila at iki.fi
>
> with comment changes only.
>
> Tomi
>
>  emacs/notmuch-mua.el | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index ff8149b..d41c0b3 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -196,11 +196,16 @@ list."
>  			    nil (notmuch-mua-get-switch-function))))
>  
>        ;; 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)))
> +      ;; if one is present, and after any other content
> +      ;; message*setup-hooks may have added to the message body already.
> +      (save-restriction
> +	(message-goto-body)
> +	(narrow-to-region (point) (point-max))
> +	(goto-char (point-max))
> +	(if (re-search-backward message-signature-separator nil t)
> +	    (if message-signature-insert-empty-line
> +		(forward-line -1))
> +	  (goto-char (point-max))))
>  
>        (let ((from (plist-get original-headers :From))
>  	    (date (plist-get original-headers :Date))
> -- 
> 1.8.0
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list