unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: notmuch@notmuchmail.org
Cc: Teemu Likonen <tlikonen@iki.fi>, David Edmondson <dme@dme.org>
Subject: [PATCH v4] Emacs: Force left-to-right display for message headers
Date: Wed,  5 Aug 2020 13:32:07 +0300	[thread overview]
Message-ID: <20200805103207.14595-1-tlikonen@iki.fi> (raw)
In-Reply-To: <m2d045beaz.fsf@dme.org>

Insert invisible U+200E LEFT-TO-RIGHT MARK character at the beginning
of message header paragraph in notmuch-show buffer. The U+200E
character forces the header paragraph as left-to-right text even if
the header content started with right-to-left characters.

See Emacs Lisp reference manual section "(elisp) Bidirectional
Display" for more info.

Reviewed-by: David Edmondson <dme@dme.org>
---
 emacs/notmuch-show.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index c9170466..6548891f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -466,9 +466,14 @@ 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)
+	    ;; Add invisible U+200E LEFT-TO-RIGHT MARK character (see
+	    ;; above) to force the header paragraph as left-to-right
+	    ;; text even if the header content started with
+	    ;; right-to-left characters.
+	    (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
 	    (notmuch-sanitize
 	     (notmuch-show-clean-address (plist-get headers :From)))
 	    " ("
 	    date
-- 
2.20.1

  reply	other threads:[~2020-08-05 10:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  6:13 Message headers in right-to-left mode in Emacs notmuch-show-mode Teemu Likonen
2020-08-03  7:37 ` Teemu Likonen
2020-08-04 12:16   ` [PATCH v2] Emacs: Force left-to-right display for message headers Teemu Likonen
2020-08-04 18:02     ` [PATCH v3] " Teemu Likonen
2020-08-05  8:45       ` David Edmondson
2020-08-05  9:40         ` Teemu Likonen
2020-08-05  9:50           ` Teemu Likonen
2020-08-05 10:03           ` David Edmondson
2020-08-05 10:32             ` Teemu Likonen [this message]
2020-08-06 12:04               ` [PATCH v4] " David Bremner
2020-08-06 14:50                 ` Teemu Likonen
2020-08-06 14:59                   ` Teemu Likonen
2020-08-07  4:46                   ` [PATCH v5] Emacs: Ensure " Teemu Likonen
2020-08-07  9:23                     ` David Edmondson
2020-08-08 19:21                     ` David Bremner
2020-08-09 20:12                     ` =?utf-8?Q?T=E2=80=AEomi?= Ollila
2020-08-10  8:43                       ` David Edmondson
2020-08-10 16:45                       ` Teemu Likonen
2020-08-10 18:27                         ` Sanitize bidi control chars Teemu Likonen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200805103207.14595-1-tlikonen@iki.fi \
    --to=tlikonen@iki.fi \
    --cc=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).