From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 KJCvBiJrv2JbHgEAbAwnHQ (envelope-from ) for ; Fri, 01 Jul 2022 23:46:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UCCJBiJrv2KLggEA9RJhRA (envelope-from ) for ; Fri, 01 Jul 2022 23:46:10 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (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 BB3A395BD for ; Fri, 1 Jul 2022 23:46:09 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id B07EA5F804; Fri, 1 Jul 2022 21:45:57 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 559B75F7CC for ; Fri, 1 Jul 2022 21:45:55 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 95D115FBD0; Fri, 1 Jul 2022 17:45:54 -0400 (EDT) Received: (nullmailer pid 462220 invoked by uid 1000); Fri, 01 Jul 2022 21:45:50 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 7/9] emacs/show: display count of duplicates in headerline Date: Fri, 1 Jul 2022 18:45:46 -0300 Message-Id: <20220701214548.461943-8-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220701214548.461943-1-david@tethera.net> References: <20220701214548.461943-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: ZDNV4KO6QAT4AXWLLVQDIL2KEAPTTXTF X-Message-ID-Hash: ZDNV4KO6QAT4AXWLLVQDIL2KEAPTTXTF 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=1656711969; 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=vOLeMcZzWhZzEeuJjG7/RwxC4DMLgezHrubtM8Kb5r0=; b=uQ8Ob4kjjZUMfqkdKFvz/UFFyXJPggRcPwLOZx5oYNrDTxMml4PFVtEZrqSwqDhYClYxkd uRwiotLoWLoi1KiNncci1Ov6PBpz5Hf/mnHZWBij1dVHLMsB4LUP6IXUl/ZNo0Ojb/u3jW uxgIXQ/mzwPrH6svV+ef8oJCzT+0WjMkTYMlot43c8puqgmAlAa091E1515OpRzIZW+Fv0 NtNYlnQigJXH7gUTb7+qZxzezxxD+sJcKbrux1PNyvG07Z/GX/1Lg3sYe3J2vWWqDmGuAj UXFfJQ/MZqpwFEIAFx1mCYrshzCckYywEXqupq4QeZ0IMmVdVI3vN7XGq0VfwQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656711969; a=rsa-sha256; cv=none; b=OQnYayJefJt+dGcDXoqO4DX/ENtOCmxEZfiAEEZS7Ev8qs8nanPFLQaXch1wNrpwNPgOTL ClLR6jNQLZDYFg/r84S9F1BxjK8NWt+Iy7xaxt/Ftd5idnWm8/H1IBN5VsE9q6gt5FM3O8 qW1smvD4LAMbO+qeG5IJzoZm77DRWcKYPxvrnBhAOLQphw/W8ElLjvfa8hJFUy4JN1tAkC dp4P3VZbQStovcB2d5gJtbxJCbnETQ6T/ysm9zaVUuBiSst1LMl5CxyS5ZBJUZpNHmK8bE Y2kRx3ZxEtIELyNrhT8yFZfy8PJcIYS0N9FbJ2F9yLnrRPYHB9AtR/AfPWZ9ag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.20 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: BB3A395BD X-Spam-Score: -1.20 X-Migadu-Scanner: scn0.migadu.com X-TUID: s0D6Ha4OhUJd There is no real cost here, except screen real estate. Some people might prefer hiding the duplicate count, but we leave that for a future commit. --- emacs/notmuch-show.el | 15 +++++++++++--- test/T450-emacs-show.sh | 8 +++++++- test/T460-emacs-tree.sh | 10 +++++++++- test/T465-emacs-unthreaded.sh | 12 ++++++++++- .../notmuch-show-duplicate-4 | 20 +++++++++++++++++++ 5 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 test/emacs-show.expected-output/notmuch-show-duplicate-4 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 020a7dca..edf39674 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -530,7 +530,7 @@ Return unchanged ADDRESS if parsing fails." (plist-put msg :height height) height)))) -(defun notmuch-show-insert-headerline (headers date tags depth) +(defun notmuch-show-insert-headerline (headers date tags depth duplicate file-count) "Insert a notmuch style headerline based on HEADERS for a message at DEPTH in the current thread." (let ((start (point)) @@ -550,7 +550,14 @@ message at DEPTH in the current thread." date ") (" (notmuch-tag-format-tags tags tags) - ")\n") + ")") + (insert + (if (> file-count 1) + (let ((txt (format "%d/%d\n" duplicate file-count))) + (concat + (notmuch-show-spaces-n (- (window-width) (+ (current-column) (length txt)))) + txt)) + "\n")) (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face))) @@ -1154,6 +1161,8 @@ is t, hide the part initially and show the button." (defun notmuch-show-insert-msg (msg depth) "Insert the message MSG at depth DEPTH in the current thread." (let* ((headers (plist-get msg :headers)) + (duplicate (or (plist-get msg :duplicate) 0)) + (files (length (plist-get msg :filename))) ;; Indentation causes the buffer offset of the start/end ;; points to move, so we must use markers. message-start message-end @@ -1165,7 +1174,7 @@ is t, hide the part initially and show the button." (or (and notmuch-show-relative-dates (plist-get msg :date_relative)) (plist-get headers :Date)) - (plist-get msg :tags) depth) + (plist-get msg :tags) depth duplicate files) (setq content-start (point-marker)) ;; Set `headers-start' to point after the 'Subject:' header to be ;; compatible with the existing implementation. This just sets it diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh index 9cc90d91..37940c96 100755 --- a/test/T450-emacs-show.sh +++ b/test/T450-emacs-show.sh @@ -341,7 +341,7 @@ test_expect_equal_file EXPECTED OUTPUT add_email_corpus duplicate ID3=87r2ecrr6x.fsf@zephyr.silentflame.com -test_begin_subtest "duplicate=3" +test_begin_subtest "duplicate=3, subject" test_emacs "(notmuch-show \"id:${ID3}\") (notmuch-show-choose-duplicate 3) (test-visible-output \"OUTPUT\")" @@ -367,4 +367,10 @@ cat < EXPECTED (error Duplicate 1000 out of range [1,5]) EOF test_expect_equal_file EXPECTED MESSAGES +test_begin_subtest "duplicate=4" +test_emacs "(notmuch-show \"id:${ID3}\") + (notmuch-show-choose-duplicate 4) + (test-visible-output \"OUTPUT\")" +test_expect_equal_file_nonempty $EXPECTED/notmuch-show-duplicate-4 OUTPUT + test_done diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh index bae26e3b..3a1c449e 100755 --- a/test/T460-emacs-tree.sh +++ b/test/T460-emacs-tree.sh @@ -203,7 +203,7 @@ test_expect_equal "$(cat MESSAGES)" "COMPLETE" add_email_corpus duplicate ID3=87r2ecrr6x.fsf@zephyr.silentflame.com -test_begin_subtest "duplicate=3" +test_begin_subtest "duplicate=3, subject" test_emacs "(notmuch-tree \"id:${ID3}\") (notmuch-test-wait) (notmuch-tree-show-message t) @@ -214,4 +214,12 @@ file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1) subject=$(grep '^Subject:' $file) test_expect_equal "$output" "$subject" +test_begin_subtest "duplicate=4" +test_emacs "(notmuch-show \"id:${ID3}\") + (notmuch-test-wait) + (notmuch-tree-show-message t) + (notmuch-show-choose-duplicate 4) + (test-visible-output \"OUTPUT\")" +test_expect_equal_file_nonempty $NOTMUCH_SRCDIR/test/emacs-show.expected-output/notmuch-show-duplicate-4 OUTPUT + test_done diff --git a/test/T465-emacs-unthreaded.sh b/test/T465-emacs-unthreaded.sh index 9b96c7d7..a3ff85fd 100755 --- a/test/T465-emacs-unthreaded.sh +++ b/test/T465-emacs-unthreaded.sh @@ -60,7 +60,7 @@ test_expect_equal "$(cat MESSAGES)" "COMPLETE" add_email_corpus duplicate ID3=87r2ecrr6x.fsf@zephyr.silentflame.com -test_begin_subtest "duplicate=3" +test_begin_subtest "duplicate=3, subject" test_emacs "(let ((notmuch-tree-show-out t)) (notmuch-unthreaded \"id:${ID3}\") (notmuch-test-wait) @@ -72,4 +72,14 @@ file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1) subject=$(grep '^Subject:' $file) test_expect_equal "$output" "$subject" +test_begin_subtest "duplicate=4" +test_emacs "(let ((notmuch-tree-show-out t)) + (notmuch-unthreaded \"id:${ID3}\") + (notmuch-test-wait) + (notmuch-tree-show-message nil) + (notmuch-show-choose-duplicate 4) + (test-visible-output \"OUTPUT\"))" +test_expect_equal_file_nonempty $NOTMUCH_SRCDIR/test/emacs-show.expected-output/notmuch-show-duplicate-4 OUTPUT + + test_done diff --git a/test/emacs-show.expected-output/notmuch-show-duplicate-4 b/test/emacs-show.expected-output/notmuch-show-duplicate-4 new file mode 100644 index 00000000..6bf49d81 --- /dev/null +++ b/test/emacs-show.expected-output/notmuch-show-duplicate-4 @@ -0,0 +1,20 @@ +Sean Whitton (2018-12-20) (inbox signed) 4/5 +Subject: [Pkg-emacsen-addons] Bug#916811: Increase severity to 'serious' +To: 916805@bugs.debian.org, 916807@bugs.debian.org, 916808@bugs.debian.org, 916809@bugs.debian.org, 916811@bugs.debian.org, 916867@bugs.debian.org, 916869@bugs.debian.org, 916872@bugs.debian.org, 916875@bugs.debian.org, 916876@bugs.debian.org +Date: Thu, 20 Dec 2018 18:25:26 +0000 + +[ multipart/mixed ] +[ multipart/signed ] +[ Unknown key ID 0x695B7AE4BF066240 or unsupported algorithm ] +[ text/plain ] +control: severity -1 serious + +Hello, + +Emacs 26.1 has reached Debian unstable (sooner than expected; sorry for +all the e-mails). + +[ 2-line signature. Click/Enter to show. ] +[ signature.asc: application/pgp-signature ] +[ text/plain ] +[ 4-line signature. Click/Enter to show. ] -- 2.35.2