unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: [PATCH 3/3] emacs: add duplicate support to notmuch-show-view-raw-message
Date: Thu,  4 Aug 2022 08:48:08 -0300	[thread overview]
Message-ID: <20220804114808.490686-3-david@tethera.net> (raw)
In-Reply-To: <20220804114808.490686-1-david@tethera.net>

This fixes one of the bugs reported by Gregor in [1]

[1]: id:87edxw8jp4.fsf@no.workgroup
---
 emacs/notmuch-show.el   | 8 ++++++--
 test/T450-emacs-show.sh | 1 -
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e9a9ac2c..a6650678 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -2143,12 +2143,16 @@ to show, nil otherwise."
   "View the original source of the current message."
   (interactive)
   (let* ((id (notmuch-show-get-message-id))
-	 (buf (get-buffer-create (concat "*notmuch-raw-" id "*")))
+	 (duplicate (notmuch-show-get-duplicate))
+	 (args (if (> duplicate 1)
+		   (list (format "--duplicate=%d" duplicate) id)
+		 (list id)))
+	 (buf (get-buffer-create (format "*notmuch-raw-%s-%d*" id duplicate)))
 	 (inhibit-read-only t))
     (pop-to-buffer-same-window buf)
     (erase-buffer)
     (let ((coding-system-for-read 'no-conversion))
-      (notmuch--call-process notmuch-command nil t nil "show" "--format=raw" id))
+      (apply #'notmuch--call-process notmuch-command nil t nil "show" "--format=raw" args))
     (goto-char (point-min))
     (set-buffer-modified-p nil)
     (setq buffer-read-only t)
diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 83e902f1..c4202e0a 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -383,7 +383,6 @@ test_expect_equal_file_nonempty $EXPECTED/notmuch-show-duplicate-4 OUTPUT
 
 FILE4=$(notmuch search --output=files --duplicate=4 "id:${ID3}")
 test_begin_subtest "duplicate=4, raw"
-test_subtest_known_broken
 test_emacs "(notmuch-show \"id:${ID3}\")
 	   (notmuch-show-choose-duplicate 4)
 	   (notmuch-show-view-raw-message)
-- 
2.35.2

  parent reply	other threads:[~2022-08-04 11:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 11:08 [PATCH 1/2] test/emacs: add known broken test for stashing duplicate filename David Bremner
2022-08-04 11:08 ` [PATCH 2/2] emacs: update notmuch-show-get-filename to handle duplicates David Bremner
2022-08-04 11:48   ` [PATCH 1/3] test/emacs: add known broken test for viewing raw duplicate David Bremner
2022-08-04 11:48     ` [PATCH 2/3] emacs/show: provide a more friendly function to get duplicate num David Bremner
2022-08-04 11:48     ` David Bremner [this message]
2022-08-07 10:27 ` [PATCH 1/2] test/emacs: add known broken test for stashing duplicate filename David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220804114808.490686-3-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).