From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id INNtOvoaLF/bAgAA0tVLHw (envelope-from ) for ; Thu, 06 Aug 2020 15:00:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8NIzNvoaLF+HNQAAbx9fmQ (envelope-from ) for ; Thu, 06 Aug 2020 15:00:10 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 6EF029404C7 for ; Thu, 6 Aug 2020 15:00:09 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 78AE028871; Thu, 6 Aug 2020 11:00:01 -0400 (EDT) Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [IPv6:2a0b:5c81:1c1::37]) by mail.notmuchmail.org (Postfix) with ESMTPS id 461952711C for ; Thu, 6 Aug 2020 10:59:59 -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 16E721B00B24; Thu, 6 Aug 2020 17:59:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1596725998; 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=nU+59SpfhMQhGSUyAKwahFam3KopLsls3Dv0x8+aceM=; b=SDzaFcVLj9vPPzK6BsnVC7W42cCBzCb53Bb1Jki7BnexCXnEwx3zwAPj+ut/pJPBiQfTdG Zs57lyKkLgJznNnECghS1PmPLSSzhOWIj/eAp6I/GZZ1SIkUv1cM46/nU63b8d6Xy3lpMJ 13i6XRPcvHNQt1J5WhjuGWcRjzja0dvm51qxCI9jeQC8WJRY7ya3gBhtEav7p35ZSbiMYY CoDdNyOShet1gjSnEZfH+TXrkd7ayQtMIk7mZZ7jBJvvlotcc58br1tkxL5seZOFdCjG0l Eq9yaSXb53iDnu//D7VqQaDiC9oFiDgAHWnN+r155xK18u1e1W4XjIsTRFAapQ== 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: <874kpfq14z.fsf@iki.fi> References: <20200805103207.14595-1-tlikonen@iki.fi> <87ft90x9nh.fsf@tethera.net> <874kpfq14z.fsf@iki.fi> Date: Thu, 06 Aug 2020 17:59:51 +0300 Message-ID: <871rkjq0pk.fsf@iki.fi> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1596725998; 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=nU+59SpfhMQhGSUyAKwahFam3KopLsls3Dv0x8+aceM=; b=D0pJ0Xs+oCh8fliCUHd5ZjZCczcFusoC6FqoHdtIt+nAfUJ9dgYmHnGnqyhE4spOdmAoNO qorTx97qSBgCFXw+phn/xw9iz1MKH2VJYnxDVeB8v1bL7xyY0LsuFikKrZhoYz+OTBu4ZF R561n3uK4NufCpfjWSmxk0yQGus32GqnPksqZ+u+UmkMlfF1DuKLwtTcbzHvpbbO6mmafR NWPU+dq3Yhg39CJ8teWm5NyWuSvJ/N/JoRpb4qFqdiD9YEVBGdxbXzFfRamFqsnotMokx0 OHG3OMuTJl9Emuq0OIt14M0d+XdHk1IAXnqkVITuPXdwHkkIGxb7ecmU/s0OcA== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1596725998; a=rsa-sha256; cv=none; b=I+djjX9IeXEmiF98dxvcylpWCxGELrPJlypcQN3dkz349Jam75SrmsnZr5Ubi3KVaZXURi TmqcCz5NSoA62HCZH5H7UQBxmwIDHvLb+i5o+sNeCUyq6whfRnIP0n7nFYhfokveYcVrvX +ZORcvSImdhPKFBdFpvcu02WecdijtZLIkyBbDr08KExky20/J9DX6iGScl+IjBGNzLvI5 Yw1ONCijFIsHZ9lfd8CLtK0hGv+ewY2bsbNcKiK5sprsg0J52+aQc6P7XKZ8J+ZEWx6DXA UapmzzXbI5G/3/pfourzFyD1h2pQhOSZcj/fuhPYU76Hb+gdwkPQmgkKTc7zRg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=tlikonen smtp.mailfrom=tlikonen@iki.fi Message-ID-Hash: RBIX76QW3YVJJBAAT3CTWFAPU6DZPHPL X-Message-ID-Hash: RBIX76QW3YVJJBAAT3CTWFAPU6DZPHPL 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="===============4323251832655777214==" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=iki.fi header.s=lahtoruutu header.b=SDzaFcVL; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -0.07 X-TUID: 8nhU8gAqF2hF --===============4323251832655777214== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable * 2020-08-06 17:50:36+03, Teemu Likonen wrote: > 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. Better version which is not based on any patches but the Git version: diff --git c/emacs/notmuch-show.el w/emacs/notmuch-show.el index c9170466..0eb27e33 100644 =2D-- c/emacs/notmuch-show.el +++ w/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." =2D (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 d= epth)) =2D (notmuch-sanitize =2D (notmuch-show-clean-address (plist-get headers :From))) + from " (" date ") (" =2D-=20 /// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIYEARYIAC4WIQTJW2wqtelxC1gHdbitnXWr7pTCcwUCXywa5xAcdGxpa29uZW5A aWtpLmZpAAoJEK2ddavulMJzP2IBAN1IebVPwzGSRsTp+wahiUn8o0UV+VQWEXb3 TfRreJa4AP9yHPnYYF9xZvwQBCpPIIEvtYFjSsVAgBwoZvUsEallCQ== =tf8U -----END PGP SIGNATURE----- --=-=-=-- --===============4323251832655777214== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============4323251832655777214==--