[PATCH 3/3] emacs: add duplicate support to notmuch-show-view-raw-message

Subject: [PATCH 3/3] emacs: add duplicate support to notmuch-show-view-raw-message

Date: Thu, 4 Aug 2022 08:48:08 -0300

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: David Bremner


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

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: