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 AD5gEbcIMV9EWAAA0tVLHw (envelope-from ) for ; Mon, 10 Aug 2020 08:43:35 +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 WM07DbcIMV+jXwAAB5/wlQ (envelope-from ) for ; Mon, 10 Aug 2020 08:43:35 +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 B2AD094066A for ; Mon, 10 Aug 2020 08:43:33 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6593A29B03; Mon, 10 Aug 2020 04:43:24 -0400 (EDT) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by mail.notmuchmail.org (Postfix) with ESMTPS id 871311FFA7 for ; Mon, 10 Aug 2020 04:43:21 -0400 (EDT) Received: by mail-wm1-x341.google.com with SMTP id k20so7514986wmi.5 for ; Mon, 10 Aug 2020 01:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:subject:in-reply-to:references:from:date:message-id:mime-version; bh=rorDYfKTSuk42u1hBX8SuE4IEaqltfs4ZBNE5452htQ=; b=V7dRSIMDu2petwNMKGNS36qo5vzyKWUDuDTXcm9prBKKwglC/8qBXvd/O/n7sFiWB/ M7lmBPsW7U6vhJ2ml31Iau3/o4SvnO7JPouB3x722+h3PO+Oa0EyMc6yS+wDcLjY8yAl voeNWL/R1u8tgd1XSAUFkdVbjVm4AASpjCktXNWw6yNqV8cDc5TiJuS+ZRTuGO09EG00 o3wuOWLfgBcQlBq2MwQKBXuEmOEIMu1j2CbLJLmnnWzHJ2DW3QYQDJRhQptdlrQMPv/L JvDlZu5Mk78fkwt6aLakGyUh5s+1My2qZqN7lFn8GakM9V3JKCGKzj7+cpQY7aVXOL3+ DwEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:in-reply-to:references:from:date :message-id:mime-version; bh=rorDYfKTSuk42u1hBX8SuE4IEaqltfs4ZBNE5452htQ=; b=kLpFjZfQhptOh8yeCQUjHK8t3+LojVnCNiRm/1zzOsestfeSIaCOBF7T7+ESXEGbe7 gsoMxvP9vR2aZMOaYfXDdbbX9vFdhARUHFWYJ9+pTmf7xWO5wMVXLQVCEaj65ZdrZuc0 64XBNQOXdHsgoJX9ylR/RIaXJbfX3HpSFKOZgzpeQOIlLBGNLxUUGQHCHEQ/qgqpM4/7 mUvP9tFMVymLogkj8lF4l96Qmvzf3Ya0caj5y3J6zVfbHhrs/3Fg7Zw2zMuJILEj4bC8 tgfzgCWlF/MhO3GvgEvhxnVUC0upFTEmliArZ1sENbb0V0RZLqLZqUnFoQCZWFe+F/Gu wd/Q== X-Gm-Message-State: AOAM532lf6xy4xTXdYYQRZeSWdU2T4kvkorUO94MNXAp9BsNamGNkejL YmurPBlBwz0V2PZS9Q22lt97MA== X-Google-Smtp-Source: ABdhPJzv6V6oKRYsDcMvOy3xe95wAvzQpbnvEeR54F10x9QBlAauPcI2xZTgyvWkXWUM5H1awnmGsw== X-Received: by 2002:a1c:df02:: with SMTP id w2mr26590726wmg.137.1597048995113; Mon, 10 Aug 2020 01:43:15 -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 b142sm21123740wmd.19.2020.08.10.01.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2020 01:43:14 -0700 (PDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id d3e7326d; Mon, 10 Aug 2020 08:43:13 +0000 (UTC) To: =?us-ascii?Q?=3D=3Futf-8=3FQ=3FT=3DE2=3D80=3DAEomi=3F=3D?= Ollila , Teemu Likonen , notmuch@notmuchmail.org Subject: Re: [PATCH v5] Emacs: Ensure left-to-right display for message headers In-Reply-To: References: <874kpfq14z.fsf@iki.fi> <20200807044641.3745-1-tlikonen@iki.fi> X-HGTTG: heart-of-gold From: David Edmondson Date: Mon, 10 Aug 2020 09:43:13 +0100 Message-ID: MIME-Version: 1.0 Message-ID-Hash: 3MSFZLXIKYRUBD6C53NFVTTRECZHF7YB X-Message-ID-Hash: 3MSFZLXIKYRUBD6C53NFVTTRECZHF7YB 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=V7dRSIMD; 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: 1.23 X-TUID: 9uDDm9Lwd93K On Sunday, 2020-08-09 at 23:12:28 +03, =?utf-8?Q?T=E2=80=AEomi?= Ollila wrote: > How about this =D Your point being that the code sanitising the displayed header could do better? > (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 > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org dme. -- Our President's crazy, did you hear what he said?