From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ULftArodLV8yIgAA0tVLHw (envelope-from ) for ; Fri, 07 Aug 2020 09:24: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 mp2 with LMTPS id 4ErDObkdLV83NgAAB5/wlQ (envelope-from ) for ; Fri, 07 Aug 2020 09:24:09 +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 4CC5294062F for ; Fri, 7 Aug 2020 09:24:08 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id EAAD329A81; Fri, 7 Aug 2020 05:23:58 -0400 (EDT) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by mail.notmuchmail.org (Postfix) with ESMTPS id BD289287B3 for ; Fri, 7 Aug 2020 05:23:55 -0400 (EDT) Received: by mail-wm1-x344.google.com with SMTP id 9so1113471wmj.5 for ; Fri, 07 Aug 2020 02:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:cc:subject:in-reply-to:references:from:date:message-id :mime-version; bh=LF7Y+YDTJ6uiQKNbhvkU5wTMsv+DZ/hgsWuG/a9OSQE=; b=FFt3ahIqit1+DuGAWe/ArcaBUEp/BIX222A4zzQub5inPyzbP+25wtttK7aNtqFW4h Tu6eZSgQASegzJEz5lWK2GTjGoLpDAuhSRQDtLxs7znB2tShxOmCQxkAl4iKeXMcJDdH ygMP2OG5pTEMbCrrWEg7nN3TZIP3pkDfk5vu0LtoWS8fj2VjeMwSrHlkg2wS8Oxdm/m5 QqOv20lDqB1C9A7UGXIp41LaxPitTS0xg1sAf0TlMsYgqHwGxXs5ueZ9umnK0+l6TtFO +cYefh0p3m0o4UI1F5SERKRpGZcdtofT57flM/ozijInNC4jHzG1X0zK6Y3eLuTzD57L /x8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:in-reply-to:references:from:date :message-id:mime-version; bh=LF7Y+YDTJ6uiQKNbhvkU5wTMsv+DZ/hgsWuG/a9OSQE=; b=A9g+80Jw+YuMp9Ni4fd8kjCwvXBk+9LHOWt8ZTI1Ct46gzEgsGuQfsj4tGcl0CDodQ bhS8PqJ9AAOfaCWTqiaMBdsrm20LWaI3ElBERsI4IHQT7Dy+N+qciaCZIeJfDvec5w1a d2H8By1a3y9uCmS4cf8Bwp4ZiR1XM7p2stxspOK6KLdrJEhVNIU2SkoEfB2YIs+6Prcl VjCdatRQE0PMk4cyf+2eR7f45kvp+07JxQkBsuH+4Iv6dK2JICWbpRupdrfnYy6qeBw/ Vwg/fWe9kA/j49k/SXO3HvmbJZ20Twka7NbbwSgGJO/j5HhxlPer6VmwUgoImy2DFH7n 6M4w== X-Gm-Message-State: AOAM530qdABvTarfmUHsuw2CDDjfRTZHz7dQ9Oz/tdC3rrmHQVEuaf/v KN5CXurBxZl75OIlqmDYj5EHlsR7XSvXnw== X-Google-Smtp-Source: ABdhPJzI+XBVQCPW6QTZwCd7FFGsAyvIPGn3r4yhen1PagC0FCh0D4K4b5mZLyOcOgoOcUtjL6SCQw== X-Received: by 2002:a1c:ba83:: with SMTP id k125mr11956575wmf.160.1596792233448; Fri, 07 Aug 2020 02:23:53 -0700 (PDT) Received: from disaster-area.hh.sledj.net (8.a.e.d.0.0.0.0.0.0.0.0.4.6.0.0.0.4.1.7.1.7.b.b.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:bb71:7140:64::dea8]) by smtp.gmail.com with ESMTPSA id n24sm9918329wmi.36.2020.08.07.02.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2020 02:23:52 -0700 (PDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 2ae4a23d; Fri, 7 Aug 2020 09:23:51 +0000 (UTC) To: Teemu Likonen , notmuch@notmuchmail.org Cc: David Bremner , Teemu Likonen Subject: Re: [PATCH v5] Emacs: Ensure left-to-right display for message headers In-Reply-To: <20200807044641.3745-1-tlikonen@iki.fi> References: <874kpfq14z.fsf@iki.fi> <20200807044641.3745-1-tlikonen@iki.fi> X-HGTTG: heart-of-gold From: David Edmondson Date: Fri, 07 Aug 2020 10:23:51 +0100 Message-ID: MIME-Version: 1.0 Message-ID-Hash: 62R4RVMN6YMWTGNGWCNQ2EZCMQF35PVC X-Message-ID-Hash: 62R4RVMN6YMWTGNGWCNQ2EZCMQF35PVC X-MailFrom: dme@dme.org 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=dme-org.20150623.gappssmtp.com header.s=20150623 header.b=FFt3ahIq; 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.03 X-TUID: 1zsKJZ0OLxCc On Friday, 2020-08-07 at 07:46:41 +03, Teemu Likonen wrote: > 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. Reviewed-by: David Edmondson > --- > emacs/notmuch-show.el | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > > As the commit description says this version inserts U+200E > LEFT-TO-RIGHT MARK only if the first header line (From header) > contains a right-to-left character. > > This version is probably friendlier to the current test files which > don't expect to see U+200E LEFT-TO-RIGHT MARK in the output. > > > 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 > ") (" > -- > 2.20.1 dme. -- At least they're not lonely.