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

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

Date: Thu, 06 Aug 2020 17:59:51 +0300

To: David Bremner,

Cc: David Edmondson

From: Teemu Likonen

* 2020-08-06 17:50:36+03, Teemu Likonen wrote:

> But here is another idea for the whole thing: When displaying a message
> in notmuch-show buffer check if message's From header has any
> right-to-left characters and only if it does add invisible U+200E
> character at the beginning, otherwise don't bother. This way those tests
> probably won't be affected. What do you think?
> Below is a quick try on the top of my previous (v4) patch. I'll do a
> proper patch later.

Better version which is not based on any patches but the Git version:

diff --git c/emacs/notmuch-show.el w/emacs/notmuch-show.el
index c9170466..0eb27e33 100644
--- c/emacs/notmuch-show.el
+++ w/emacs/notmuch-show.el
@@ -466,10 +466,16 @@ 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)))
+  (let ((start (point))
+	(from (notmuch-sanitize
+	       (notmuch-show-clean-address (plist-get headers :From)))))
+    (when (string-match "\\cR" from)
+      ;; If the From header has a right-to-left character add
+      ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
+      ;; the header paragraph as left-to-right text.
+      (insert (propertize (string ?\x200e) 'invisible t)))
     (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
-	    (notmuch-sanitize
-	     (notmuch-show-clean-address (plist-get headers :From)))
+	    from
 	    " ("
 	    ") ("

/// Teemu Likonen - .-..
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450
signature.asc (application/pgp-signature)
notmuch mailing list --
To unsubscribe send an email to