Re: [PATCH v3] Emacs: Force left-to-right display for message headers
On Wednesday, 2020-08-05 at 12:40:06 +03, Teemu Likonen wrote: > * 2020-08-05 09:45:23+01, David Edmondson wrote: > >> I've no idea if this is the appropriate approach to addressing this, but >> the resulting behaviour is obviously an improvement over what happens >> now. > > I think there are two options: > > 1. Add a string like "From: " in the beginning of notmuch-show header > paragraph so that the paragraph always starts with left-to-right > characters (those latin letters "From"). > > 2. Add invisible characters that force left-to-right text for the > paragraph. Character U+200E LEFT-TO-RIGHT MARK is meant for > controlling exactly that. > > My patch implements the option 2 and... It seems fine. Reviewed-by: David Edmondson >> It would make sense to add some commentary to the code as well as the >> commit message explaining the reason for inserting the seemingly >> arbitrary character. > > ...it has at least comment > > ; U+200E LEFT-TO-RIGHT MARK > > in the code. I think that explains the purpose quite well. More verbose > explanation could be something like this: > > ;; Add invisible U+200E LEFT-TO-RIGHT MARK character to force the > ;; header paragraph as left-to-right text even if some header's > ;; content is right-to-left. This is much more useful to someone looking at the code (I know that the explanation is in the commit, but when things get moved around a lot, chasing back through commit messages can be time consuming and difficult). dme. -- It's gettin', it's gettin', it's gettin' kinda hectic. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v3] Emacs: Force left-to-right display for message headers
* 2020-08-05 12:40:06+03, Teemu Likonen wrote: > I think there are two options: > > 1. Add a string like "From: " in the beginning of notmuch-show header > paragraph so that the paragraph always starts with left-to-right > characters (those latin letters "From"). > > 2. Add invisible characters that force left-to-right text for the > paragraph. Character U+200E LEFT-TO-RIGHT MARK is meant for > controlling exactly that. 3. Bad option: (setq bidi-paragraph-direction 'left-to-right) for the whole notmuch-show buffer. This is not good idea because also the message body is forced to left-to-right direction (even if it contained right-to-left text). -- /// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v3] Emacs: Force left-to-right display for message headers
* 2020-08-05 09:45:23+01, David Edmondson wrote: > I've no idea if this is the appropriate approach to addressing this, but > the resulting behaviour is obviously an improvement over what happens > now. I think there are two options: 1. Add a string like "From: " in the beginning of notmuch-show header paragraph so that the paragraph always starts with left-to-right characters (those latin letters "From"). 2. Add invisible characters that force left-to-right text for the paragraph. Character U+200E LEFT-TO-RIGHT MARK is meant for controlling exactly that. My patch implements the option 2 and... > It would make sense to add some commentary to the code as well as the > commit message explaining the reason for inserting the seemingly > arbitrary character. ...it has at least comment ; U+200E LEFT-TO-RIGHT MARK in the code. I think that explains the purpose quite well. More verbose explanation could be something like this: ;; Add invisible U+200E LEFT-TO-RIGHT MARK character to force the ;; header paragraph as left-to-right text even if some header's ;; content is right-to-left. -- /// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v3] Emacs: Force left-to-right display for message headers
On Tuesday, 2020-08-04 at 21:02:25 +03, Teemu Likonen wrote: > 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. > --- > >> This message can be applied with "git am --scissors". > > Sorry, it doesn't apply with "git am". Maybe PGP/MIME or > quoted-printable encoding messed it up. This time I try with "git > send-email". I've no idea if this is the appropriate approach to addressing this, but the resulting behaviour is obviously an improvement over what happens now. It would make sense to add some commentary to the code as well as the commit message explaining the reason for inserting the seemingly arbitrary character. > 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 > ___ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-le...@notmuchmail.org dme. -- Too much information, running through my brain. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH v3] Emacs: Force left-to-right display for message headers
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. --- > This message can be applied with "git am --scissors". Sorry, it doesn't apply with "git am". Maybe PGP/MIME or quoted-printable encoding messed it up. This time I try with "git send-email". 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 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org