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

Jani Nikula jani at nikula.org
Thu Sep 5 07:11:19 PDT 2013


On Wed, 04 Sep 2013, "Tomi.Ollila" <tomi.ollila at iki.fi> wrote:
> From: Tomi Ollila <tomi.ollila at iki.fi>
>
> 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 (and `message-signature-setup-hook' not intervening) 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).
>
> Original patch from "Geoffrey H. Ferrari", continued with iterations
> from Jani and Mark.

Hi Tomi, I don't think you've sufficiently convinced me why we need all
this complexity instead of just doing [1]. And if you do get me
convinced, I'd like the reason to be in the commit message and in a
comment above the piece of code in question.

Cheers,
Jani.


[1] id:cover.1377718199.git.jani at nikula.org




> ---
>  emacs/notmuch-mua.el | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 2baae5f..0280c9f 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -192,10 +192,14 @@ list."
>  
>        ;; 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)))
> +      (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