Re: [PATCH v3] Emacs: Force left-to-right display for message headers

Subject: Re: [PATCH v3] Emacs: Force left-to-right display for message headers

Date: Wed, 05 Aug 2020 09:45:23 +0100

To: Teemu Likonen, notmuch@notmuchmail.org

Cc: Teemu Likonen

From: David Edmondson


On Tuesday, 2020-08-04 at 21:02:25 +03, Teemu Likonen wrote:

> Insert invisible U+200E LEFT-TO-RIGHT MARK at the beginning of message
> headers. It forces message headers to display as left-to-right text
> even if there are strong directional characters in header's values.
>
> See Emacs Lisp reference manual section "(elisp) Bidirectional
> Display" for more info.
> ---
>
>> This message can be applied with "git am --scissors".
>
> Sorry, it doesn't apply with "git am". Maybe PGP/MIME or
> quoted-printable encoding messed it up. This time I try with "git
> send-email".

I've no idea if this is the appropriate approach to addressing this, but
the resulting behaviour is obviously an improvement over what happens
now.

It would make sense to add some commentary to the code as well as the
commit message explaining the reason for inserting the seemingly
arbitrary character.

>  emacs/notmuch-show.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index c9170466..c45db57d 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -466,9 +466,10 @@ unchanged ADDRESS if parsing fails."
>  (defun notmuch-show-insert-headerline (headers date tags depth)
>    "Insert a notmuch style headerline based on HEADERS for a
>  message at DEPTH in the current thread."
>    (let ((start (point)))
> -    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
> +    (insert (propertize (string ?\x200e) 'invisible t) ; U+200E LEFT-TO-RIGHT MARK
> +	    (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
>  	    (notmuch-sanitize
>  	     (notmuch-show-clean-address (plist-get headers :From)))
>  	    " ("
>  	    date
> -- 
> 2.20.1
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

dme.
-- 
Too much information, running through my brain.
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: