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

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

Date: Tue, 4 Aug 2020 21:02:25 +0300

To: notmuch@notmuchmail.org

Cc: Teemu Likonen

From: Teemu Likonen

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

 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-show-clean-address (plist-get headers :From)))
 	    " ("
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org