From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CPEXF9YYLF8KfQAA0tVLHw (envelope-from ) for ; Thu, 06 Aug 2020 14:51:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id OKr7EtYYLF/gFQAA1q6Kng (envelope-from ) for ; Thu, 06 Aug 2020 14:51:02 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E49A094060D for ; Thu, 6 Aug 2020 14:51:00 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id C4AE028871; Thu, 6 Aug 2020 10:50:51 -0400 (EDT) X-Greylist: delayed 161270 seconds by postgrey-1.36 at nmbug; Thu, 06 Aug 2020 10:50:48 EDT Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [IPv6:2a0b:5c81:1c1::37]) by mail.notmuchmail.org (Postfix) with ESMTPS id 8AA982711C for ; Thu, 6 Aug 2020 10:50:48 -0400 (EDT) Received: from mithlond (mobile-access-6df022-134.dhcp.inet.fi [109.240.34.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: tlikonen) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 8D1F21B00B04; Thu, 6 Aug 2020 17:50:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1596725443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oYQXPW4EbFwZvywzK6Vn39v/6U6/50gY2wIq6OgqrfE=; b=udKzq9COqRUrs0gI4L8a0q+kuGWQB+06klsYol3XEOXYMsNf09hUra/VB2S1vm7nyev15c PYAxCzWOs2s+/HU4u/TNYCHPcsjGvtt/TLs+GxCJqEUXFLhrjmsmErdJSFA5cSN5btIhjI KzscZ82fpQWx/7VK/kVSZhAIFL8BXi0hR0tgenWrlUjMuOyHRTRb/J59ca6RaVq00Tr9Qo zbUgNXSWuhzCNFw39u2pXDeXgefIPkKgbYVYVAM7nk2XkTxV7EfadiMA7UcOSuXnYvX+xB neHlvW4Hl9LoPmZDUw5C+D3GybRoh0jgFkLsJN1hXq1qNKvbBP3hgLbzvDrxPg== From: Teemu Likonen To: David Bremner , notmuch@notmuchmail.org Cc: David Edmondson Subject: Re: [PATCH v4] Emacs: Force left-to-right display for message headers In-Reply-To: <87ft90x9nh.fsf@tethera.net> References: <20200805103207.14595-1-tlikonen@iki.fi> <87ft90x9nh.fsf@tethera.net> Date: Thu, 06 Aug 2020 17:50:36 +0300 Message-ID: <874kpfq14z.fsf@iki.fi> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1596725443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oYQXPW4EbFwZvywzK6Vn39v/6U6/50gY2wIq6OgqrfE=; b=bqzZbRz5LwHLhQUd5euQE5/NIHbBzKxJqVLD8jdQQgsOY6TjDOYHCog2/gGNx1raHdY+57 LJbnr2/egjg92g8Y+/81Ajq5t7juCPSUVDOlJ9OIxSY2FQUGFyVrwMYyMnTkauaMIcjfVI 8lLVAzLB0NyK4dr+kuud+eKFJAtVj0MtX6AAJkbaRgazhUH+Ic9rVlHnyICcKHFquR/FPZ FqIMxPMpVU782nj2jAVU0wzlDLNdxIPpOKoqr9w1+mvnI0WkwOJRv0KJuUa44X3/GCc90b RyCdAMD5jLK9dPIFTaxCslqZq5uE5ZUToEeW+NV77olsG0wE/jxrqK8Q5NrXqg== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1596725443; a=rsa-sha256; cv=none; b=ACj+4HEeK3pIpk/sGJW1mW4Q8y99zuNDGkT8XB1hc8OA4fgujq70VtElQQ2B82WKq2R5pK 6Xwls7St3Rrxyei6n9sjviDAEm4PiLvhaz1ImpgaNn9QAiD+6fLPeRTQtEld0Q2IQJag0r Yth9abVSLp/Na3OsXEuHvpGeTARAxmhW/ZsHIDBuN+31E47ebFZhM172zt6eV7S22yiVoL sxosjgxA3/CwTaw2niPCdlEsaAxwsj+KWCLoCXoeh/mazn2kHPBDJ42MCco3JB7qPXvt93 fPfhyKEsWqo+FJH2k1UGwTaddX7RcrFDzQiobevvnhIRCuwgV7P9dua5OTWY5Q== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=tlikonen smtp.mailfrom=tlikonen@iki.fi Message-ID-Hash: ATLVB2RFXD5OSA645DDQQCH4FR5V4QB7 X-Message-ID-Hash: ATLVB2RFXD5OSA645DDQQCH4FR5V4QB7 X-MailFrom: tlikonen@iki.fi X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============0893950143849836615==" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=iki.fi header.s=lahtoruutu header.b=udKzq9CO; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -0.07 X-TUID: TIxhopcSCme0 --===============0893950143849836615== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable * 2020-08-06 09:04:50-03, David Bremner wrote: > This causes 10 tests to fail for me. At a guess, the added > LEFT-TO-RIGHT MARK should probably be stripped out in the test > framework. Either that or added to test output files. The latter > sounds easy to miss when editing. For the first time I ran the tests and got over 60 test fails. :-) I'm probably doing something wrong and have to study the test framework better. I don't know which tests are related to the U+200E LEFT-TO-RIGHT MARK patch but if test output files are representing the content of notmuch-show-mode buffer then I think U+200E belongs in those expected output files, even if the character is invisible. But here is another idea for the whole thing: When displaying a message in notmuch-show buffer check if message's From header has any right-to-left characters and only if it does add invisible U+200E character at the beginning, otherwise don't bother. This way those tests probably won't be affected. What do you think? Below is a quick try on the top of my previous (v4) patch. I'll do a proper patch later. diff --git i/emacs/notmuch-show.el w/emacs/notmuch-show.el index 6548891f..6b7d70d9 100644 =2D-- i/emacs/notmuch-show.el +++ w/emacs/notmuch-show.el @@ -465,22 +465,23 @@ unchanged ADDRESS if parsing fails." =20 (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." =2D (let ((start (point))) =2D (insert (propertize (string ?\x200e) 'invisible t) =2D ;; Add invisible U+200E LEFT-TO-RIGHT MARK character (see =2D ;; above) to force the header paragraph as left-to-right =2D ;; text even if the header content started with =2D ;; right-to-left characters. =2D (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth)) =2D (notmuch-sanitize =2D (notmuch-show-clean-address (plist-get headers :From))) =2D " (" =2D date =2D ") (" =2D (notmuch-tag-format-tags tags tags) =2D ")\n") + (let ((start (point)) + (from (notmuch-sanitize + (notmuch-show-clean-address (plist-get headers :From))))) + (insert (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. + (propertize (string ?\x200e) 'invisible t)) + (notmuch-show-spaces-n (* notmuch-show-indent-messages-width d= epth)) + from + " (" + date + ") (" + (notmuch-tag-format-tags tags tags) + ")\n") (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summa= ry-face))) =20 (defun notmuch-show-insert-header (header header-value) "Insert a single header." =2D-=20 /// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIYEARYIAC4WIQTJW2wqtelxC1gHdbitnXWr7pTCcwUCXywYvBAcdGxpa29uZW5A aWtpLmZpAAoJEK2ddavulMJz1WEBAJHfL0E6s2U7efpZ0k3HAed+aoavfT1FTdJW WJYycy81AP4zvbp1eXbIgQnVhrqitD5xJrMQMaOnmkt1r819mfm9Cg== =7V+L -----END PGP SIGNATURE----- --=-=-=-- --===============0893950143849836615== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============0893950143849836615==--