* 2020-08-03 09:13:35+03, Teemu Likonen wrote:

> I believe the header part can be switched to left-to-right mode by
> using function bidi-string-mark-left-to-right.

It seems that adding just a single U+200E LEFT-TO-RIGHT MARK character
(possibly with invisible text property) in the beginning of message
header paragraph will do. The attached (inline) patch does it.

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

Insert 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..87f68bc8 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -467,7 +467,8 @@ unchanged ADDRESS if parsing fails."
   "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)))
 	    " ("
-- 
2.20.1

-- 
/// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450

Attachment: signature.asc
Description: PGP signature

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to