From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2BioDAqy62JJNAAAbAwnHQ (envelope-from ) for ; Thu, 04 Aug 2022 13:48:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MLiSDAqy62J4EAEAauVa8A (envelope-from ) for ; Thu, 04 Aug 2022 13:48:26 +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 0A7A52FEC4 for ; Thu, 4 Aug 2022 13:48:26 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 70A9A5F3CF; Thu, 4 Aug 2022 11:48:19 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 763D75F37E for ; Thu, 4 Aug 2022 11:48:16 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id CA24C5FBC2; Thu, 4 Aug 2022 07:48:15 -0400 (EDT) Received: (nullmailer pid 490704 invoked by uid 1000); Thu, 04 Aug 2022 11:48:13 -0000 From: David Bremner To: David Bremner , notmuch@notmuchmail.org Subject: [PATCH 2/3] emacs/show: provide a more friendly function to get duplicate num Date: Thu, 4 Aug 2022 08:48:07 -0300 Message-Id: <20220804114808.490686-2-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220804114808.490686-1-david@tethera.net> References: <20220804110833.322155-2-david@tethera.net> <20220804114808.490686-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: QSU4FX2H74K4PFXLQ55YNPG7Z4LT6ZRD X-Message-ID-Hash: QSU4FX2H74K4PFXLQ55YNPG7Z4LT6ZRD X-MailFrom: bremner@tethera.net 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 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=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659613706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=eu3baElqou+Gsnj3Ypeh7pfk9TSPGrU61SNaIMUWAmg=; b=WphG0bvgemY/ACsFaPT9F9C6kSQZGWzsEcTUsQ6ZeBr7+DwzpvOUX3D62Iah89Ez0kQE5Y XKkc7AsbsVgE1lMLygNYJJ4J+dgmeOSs4x4mnLQ2fDbELhO/sanfRhhAL7eUIZqg1GaRnp RvIYpmwPHzRglimm+ZpPGtH2j3+Keyzon3qe0R8a4rl8+ncmXo9zNvLCzdYApBV8RYrAcW DspODlIQizPhwxkYhroCbZd+BL9gw8gbvy8pkdcl9CpPMKWSt7KL69OeTKDaOOR0ioyH1F susV6sZAmtrD5kXWJYd2yz+mM0e0uGu7mblxLwDGLKoXvL6lVxEvA7BeQGOSgw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659613706; a=rsa-sha256; cv=none; b=FDtw2kd0NnGr5vXGiOp9LZz7fmjHH0LSKRyFMlozGZgmXy05/HgLpHx9PDqCghxYnJZuuR 8ANp6ZuHORpeaXnVKMY4RrdPajdvLbvPRiO6gKsdlb5JTwmAn+2erDWWLmXwGOeZMNzsU9 piXeAPqHYeE/1Vyk68H/rdlQuzZ1MKWuDXbkMLEP3w4IVkCQrGgoLOT0s502JibkD6aM4L WEV2x2mOvz8U1wK0Z0MjYO9p+byca7E1DZxhA6RmsuYAG2LrD7B/sa8bSCS5P1wNsa3C4U gyNpY4pdI4RnpKSv0/YMsHsZtafJj1Hc0UvXFDA7g/t1v0l5A94odUn3qlYrag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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: -2.11 Authentication-Results: aspmx1.migadu.com; dkim=none; 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: 0A7A52FEC4 X-Spam-Score: -2.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: HUE+MiHMGHww There is not much code here, but at least we can fix the indexing as 1 based. --- emacs/notmuch-show.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 527db4bb..e9a9ac2c 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1813,7 +1813,7 @@ current thread." (defun notmuch-show-get-filename () "Return the filename of the current message." - (let ((duplicate (or (notmuch-show-get-prop :duplicate) 1))) + (let ((duplicate (notmuch-show-get-duplicate))) (nth (1- duplicate) (notmuch-show-get-prop :filename)))) (defun notmuch-show-get-header (header &optional props) @@ -1826,6 +1826,10 @@ current thread." (defun notmuch-show-get-date () (notmuch-show-get-header :Date)) +(defun notmuch-show-get-duplicate () + ;; if no duplicate property exists, assume first file + (or (notmuch-show-get-prop :duplicate) 1)) + (defun notmuch-show-get-timestamp () (notmuch-show-get-prop :timestamp)) -- 2.35.2