emacs: add duplicate support to notmuch-show-view-raw-message

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

[1]: id:87edxw8jp4.fsf@no.workgroup
This commit is contained in:
David Bremner 2022-08-04 08:48:08 -03:00
parent 05c85290ca
commit 6d6d2a5fe7
2 changed files with 6 additions and 3 deletions

View file

@ -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)

View file

@ -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)