diff options
author | Teemu Likonen <tlikonen@iki.fi> | 2020-08-07 07:46:41 +0300 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2020-08-08 16:18:23 -0300 |
commit | e3fd546ad75411ed310202e52e1c88bbd9616651 (patch) | |
tree | 64ad709cae2bdce069e62d5ceb3353f5e63614b9 /emacs | |
parent | f5ae8040b3ebba8ffa1be485c3a74397df98138e (diff) |
Emacs: Ensure left-to-right display for message headers
In notmuch-show buffer insert invisible U+200E LEFT-TO-RIGHT MARK
character at the beginning of message header paragraph if the From
header contains a right-to-left character. This ensures that the
header paragraph is always rendered in left-to-right mode.
See Emacs Lisp reference manual section "(elisp) Bidirectional
Display" for more info.
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/notmuch-show.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c9170466..0eb27e33 100644 --- a/emacs/notmuch-show.el +++ b/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 " (" date ") (" |