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

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

Date: Tue, 04 Aug 2020 15:16:56 +0300

To: notmuch@notmuchmail.org

Cc:

From: Teemu Likonen


* 2020-08-03 10:37:11+03, Teemu Likonen wrote:

> From 4264a1b3561c132343fe6a74e8cf2548e5127c3e Mon Sep 17 00:00:00 2001
> From: Teemu Likonen <tlikonen@iki.fi>
> Date: Mon, 3 Aug 2020 10:25:27 +0300
> Subject: [PATCH] Emacs: Force left-to-right display for message headers

Here's slightly better patch with (string ?\x200e) instead of (string
#x200e) because STRING function wants characters as argument.
Conceptually:

  ?\x200e  = character
  #x200e   = integer

In the current Emacs they are both integers (8206).

This message can be applied with "git am --scissors".

--- 8< ----
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.
---
 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




-- 
/// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450
signature.asc (application/pgp-signature)
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: