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 QpOfCcdYMF9aCQAA0tVLHw (envelope-from ) for ; Sun, 09 Aug 2020 20:12:55 +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 g3P2BMdYMF8HLAAA1q6Kng (envelope-from ) for ; Sun, 09 Aug 2020 20:12:55 +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 9463D9404CF for ; Sun, 9 Aug 2020 20:12:53 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6C18E29AED; Sun, 9 Aug 2020 16:12:44 -0400 (EDT) Received: from lahtoruutu.iki.fi (unknown [IPv6:2a0b:5c81:1c1::37]) by mail.notmuchmail.org (Postfix) with ESMTPS id 7FB661FA22 for ; Sun, 9 Aug 2020 16:12:42 -0400 (EDT) Received: from guru.guru-group.fi (unknown [IPv6:2a02:2380:1:9:5054:ff:feb7:a4bc]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id C1B101B00118; Sun, 9 Aug 2020 23:12:29 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1597003949; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z5GxBm9Jkq2FI6L8TjTskerwUaPrjsgi+xlf5/Fzw1s=; b=MmMnkXpdpr5qNh6QAcvkVIlOLL1LlwVMVBWCcps5jZqgQ8t2NksRKcaZbecPDOEuRubqPj EQV+5jzcowdLjmaR9qgRFz+K0TFJwJQvRY3Fx2fZ+lcczDrw2lt2t/dSMIqMlJ0rlJi8OK jFTxko2MfXJCEJavoNsx0PhEq3x5UXcyC2/BYlCmzsFti51sfVwf07kJLIzvVUlf0p7si1 W3wfJ8rb1O0eXxHIRe9e1d69qFY8f77OiGx6DfKuBOgaavfwYTTqOgX+J902uJ0AHQuVb9 gkR16ytZfxfItG0wDgq4ndrZIkGdpfjbSntLInic1X1HxkcDqZyAyZOY49BTbw== From: =?us-ascii?Q?=3D=3Futf-8=3FQ=3FT=3DE2=3D80=3DAEomi=3F=3D?= Ollila To: Teemu Likonen , notmuch@notmuchmail.org 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> User-Agent: Notmuch/0.30+125~g9591a2f (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1597003949; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z5GxBm9Jkq2FI6L8TjTskerwUaPrjsgi+xlf5/Fzw1s=; b=qPJygqUB/xkW8dG5SbzNBlfJ+N+/FCy0XAA/yH2hwbSwuE8OgDMs4KYZ6OFhYd8gcBR6D+ tgaxrgwutvI7gu8R7j3/fBBZFlkmnSmFleQEYvuccBhZ8N/6pYAsHq0GxRuMe+U4HlBl2u ZLhNvH5SdBVnP2HDZHdKci/kU1M3FjtuH4JAOVBVUOzOYnqXz3Hbl2q/lOf0YLw6c4IHZJ BM3/iCdxUjcxnYyG4Fu6snxeptfYT8Bz9kV5pffnaRjVvVkAmrcYQFOBWPF2/vjT/Vkdm0 TZg/bjT2+TV0UgqLNOVRDRqr6xZo0grzSTdgBdJUyRohjBScXAb8pOrpj9AG6Q== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1597003949; a=rsa-sha256; cv=none; b=k6O872zC+w1iu0B8EQr1sVxCq86S8nvGNRcILz+uySQ8KlXJzTv/2ZGL7Stl20JTyxqhXA fpM65IHIZSYvQAuQC1NFs0zkh3KSxR6aSNNx1Igt3maARQKjjFWhe+rwm1SBTJQOgjR+hq N9yrvgBUN8UEz/4VJMXWWIZgcsE5SQuizmFdEEdhM3UpoknoOT74wQOKSqARMB7blEXEuF 2/g3hs3FCUYmdphwvh9CSCB4WuU4hEOrEjbpyeO0skoE3LQPOCRUbxaOJqdYVdtiOpRzJK 8j7Fc5+DcONE7sxfVRW2Xl+wKyfJAVlLF/nH3hFCrLncg+twC7Dsi35g637hAQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi Message-ID-Hash: P3YBAN3NXB5PHVFTCKKGGWNL7XEZTPEO X-Message-ID-Hash: P3YBAN3NXB5PHVFTCKKGGWNL7XEZTPEO X-MailFrom: tomi.ollila@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: 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=iki.fi header.s=lahtoruutu header.b=MmMnkXpd; 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: 3.23 X-TUID: dCNHxKpowJwf How about this =D (Sorry how the headers might look...) From: contains U+202E (LEFT-TO-RIGHT OVERRIDE) (in =?utf-8?Q?T=E2=80=AEomi?=) https://www.fileformat.info/info/unicode/char/202e/index.htm Tomi --- (top-posting on purpose, all rest is for reference only) On Fri, Aug 07 2020, 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. > --- > 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