Re: [PATCH] emacs: escape % in header line format

Subject: Re: [PATCH] emacs: escape % in header line format

Date: Thu, 22 Jan 2015 00:15:50 -0800

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Jinwoo Lee


Thanks, David.  But I don't think it's the correct fix.  REPLACE-STRING
seems to replace a string in a buffer, not a string given as a param.
And it's for interactive use only.

-jinwoo

On Wed, Jan 21, 2015 at 11:18 PM, David Bremner <david@tethera.net> wrote:
> We set header-line-format to the message subject, but if the subject
> contains percents, the next character is interpreted as a formatting
> control, which is not desired.
> ---
>
> Ironically you have to apply this patch to read it's subject properly
> ;).  There is whitespace change here because the original line was way
> too long.
>
>  emacs/notmuch-show.el | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 9f6fe07..4258d43 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1198,7 +1198,11 @@ function is used."
>        (notmuch-show-mapc (lambda () (notmuch-show-set-prop :orig-tags (notmuch-show-get-tags))))
>  
>        ;; Set the header line to the subject of the first message.
> -      (setq header-line-format (notmuch-sanitize (notmuch-show-strip-re (notmuch-show-get-subject))))
> +      (setq header-line-format
> +	    (replace-string "%" "%%"
> +			    (notmuch-sanitize
> +			     (notmuch-show-strip-re
> +			      (notmuch-show-get-subject)))))
>  
>        (run-hooks 'notmuch-show-hook))))
>  
> -- 
> 2.1.4

Thread: