From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kDyGEfrSLGMWDwAAbAwnHQ (envelope-from ) for ; Thu, 22 Sep 2022 23:26:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id ABiQEfrSLGNkfgAA9RJhRA (envelope-from ) for ; Thu, 22 Sep 2022 23:26:18 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D736F3140F for ; Thu, 22 Sep 2022 23:26:17 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id B4F5B5F3D0; Thu, 22 Sep 2022 21:26:14 +0000 (UTC) Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [IPv6:2a0b:5c81:1c1::37]) by mail.notmuchmail.org (Postfix) with ESMTPS id 6B2445F35B for ; Thu, 22 Sep 2022 21:26:12 +0000 (UTC) Received: from c53.nor.fi (unknown [IPv6:2a0b:a700:bb::53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id B0D411B00120; Fri, 23 Sep 2022 00:26:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1663881971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=r7fCBNFsb9o+P2hX5kTQgqZ2sNnqgtWffHLCKyc4DKE=; b=hSsHgXEAgJbXA+5Q82MzhrwlrNgaiXgyIO+rqnrBZzjkZ74Jv0eSGMtO5iI3/SSiRrtL33 5kzgaIwDcOM62HTbV34FE13m0RBBY8TLhdX7Pz8zepfCNkKEyWa3pc0R2DpztO15z6CUY6 R9gwEfJ329k//r5Rtcz+G9B9ihNCMDXjFPvzc9xhF5fNe+uV6qs0Hm0lbp1g87LBOiW0r3 udoX2C72TzFrk2/QTVbHjb/Og72RxFrnc3PmSfyhFqUMAXXvDOsmaK5UlIzaby07ggl1wF 0yqJDPRzW3bSVu/Jh7En/gCABu0bmk+gUvCXrv1/mFyatcLo1MeQLvia75NJWw== From: Tomi Ollila To: notmuch@notmuchmail.org Subject: [PATCH] emacs: fix notmuch-show-update-tags to support duplicate files Date: Fri, 23 Sep 2022 00:26:04 +0300 Message-Id: <20220922212604.222570-1-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1663881971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=r7fCBNFsb9o+P2hX5kTQgqZ2sNnqgtWffHLCKyc4DKE=; b=Crvqgib7cUlAwIWLPyNT4Je0sJo87XAXtJRfJwQ72EjZqi8uNrJ+lwl1VA6dlk6mdjs6mP zehdm+t6djC7pU0QOTZQ/d+1fvuV+sKakwifZtC8vS4yle8e25qrJSGoZEmtMjKnUw5WoL kUdv8F7fpy/abG9px0J6vRGSmXZ54SHGwbZk94RfKNxW0eZZIk34WuqTfIClKKNmVtZXwZ ywsOeOzecbWerO/hWoeFlCRluvlu/3tmaV97xIM1A7HPm8z32wF74EBrNDKJkIFLyThasM hMjbEEEvq0nLH44vXcE8FyOjFX3SoEbJ4ByEAh2uH47cfjhm1fFReVEp32/4NA== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1663881971; a=rsa-sha256; cv=none; b=WWOw88knrhZg3ntfEF2e2c6pprsVT31YMBuJ759xarQ2NDOQ3qiY02K5qj5wAM2KiVTc8L Q1o3upECToQgJl0OT2cHclweH/VBhK4xSyEmtRodL5CkcCKnemH5DZlP9TlMvDXC79UGzn vsct7YAyQBmPCC9YFEfc5gKQhMcDz9Pw4OEyJ+whoENlhTbmrLFCVoGSgvAtjKqqTdIHhI vvYZDCRNrVsB+c2y+mW3gqHR2DUtrTiuySdLaHBTSBC+YKDtGUxrKIPT+D1PVDVO3/MRtY aUcU6dkNVmz1Wl8Z03FgMyAxUubjdMsMmWu+Xn7fvG8h66A3TNumPK/bZlLLJg== Message-ID-Hash: ZTOWE62EZGQX2YGURG4GICXKVYHR5XGG X-Message-ID-Hash: ZTOWE62EZGQX2YGURG4GICXKVYHR5XGG 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; digests; suspicious-header CC: tomi.ollila@iki.fi X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663881978; 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: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=c0/ZVbfaSF1tFYRySVzHTyEtQ8u3p4mf3PGmByswXdA=; b=kcAPnm670gEXHtChHXszmdE+WRrBKIaS2IB2q+uozzUUTPKzFRtWh8qLV6Wj/8wb2qPBgZ 5aNuojZyS54FUw7E1+pqoC9ObG+csZrc/xG2eyOMBlnizOWA8OUe3HN0DZltcQWcliEhav VnK3jtIpg7uaeSusPp/A6at/tXw1c3LNgU39n0EZpIhppvdPpDnD1YC2Av8BQO/2LOrf6y 5IQ5DXPS3f/NC9vHM2cziqp4K6XQ+cBvKhQP/83wCqaWu3ond60stwPb/AacosBBoPYepS O4DfZTBymJqNF5zYfVqNONyi5/C/678FV1NgVt/81sAOKovZTABvgDL736FVOQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1663881978; a=rsa-sha256; cv=fail; b=spdVC6Is3IQDvwa0uWtU2ykpI24ho6dGWw1s1QAIdAzpzao0Bwc5u5msmXJdz6lobnPCCJ OB1vhulb2EzzIruExGjY1t+udOvk0F49Ir50ARYqmH9puiJ3/7sAbIsvjZavF9Jm8cq9hX pounLCNuwaM17Blv+9rwCKGX6yKn65q5grWTeatGF2L/c01TG29muc9H8TjGcNJXCSrBBk 4kB3MigxzBAnBm3oboOAF9f/bLAhHNuTBXd9REs7q3xfBtqVq1fwkwvugstWvf4nrMuOV9 Phb50/YvcnWfaL2cFMY+9FvYIiksn5HB2RMs01SOKcOA53JnEw81dLn2vjFa5w== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=hSsHgXEA; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 3.36 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=hSsHgXEA; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: D736F3140F X-Spam-Score: 3.36 X-Migadu-Scanner: scn0.migadu.com X-TUID: RPc1nvrhIxsD With duplicate files, the headerlines of messages in notmuch-show buffer contains (initially) 1/n at the end of line. Update the regexp used to search and replace tag changes to match the current line -- drop unnecessary capturing of the (tags), but capture the duplicates indicator. Update the headerline pretty much like notmuch-show-insert-headerline does, like the changes introduced mostly in commit 5ea5a5557d9a. --- Is this getting too complex (well, we may have other stuff with similar complexity there ;/) ? Is there any better solutions ? emacs/notmuch-show.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ec998ede..0527c3a5 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -453,13 +453,20 @@ (defun notmuch-show-update-tags (tags) "Update the displayed tags of the current message." (save-excursion (goto-char (notmuch-show-message-top)) - (when (re-search-forward "(\\([^()]*\\))$" (line-end-position) t) - (let ((inhibit-read-only t)) - (replace-match (concat "(" - (notmuch-tag-format-tags - tags - (notmuch-show-get-prop :orig-tags)) - ")")))))) + (when (re-search-forward "([^()]*) *\\([^()]*\\)$" (line-end-position) t) + (let ((inhibit-read-only t) + (tags-str (notmuch-tag-format-tags + tags (notmuch-show-get-prop :orig-tags))) + (txt (match-string 1))) + (replace-match (concat "(" tags-str ")" + (and (string-lessp "" txt) + (notmuch-show-spaces-n + (max 0 (- (window-width) + (- (match-beginning 0) + (notmuch-show-message-top)) + (length tags-str) + (length txt) 3)))) + txt)))))) (defun notmuch-clean-address (address) "Try to clean a single email ADDRESS for display. Return a cons -- 2.30.2