This duplicates (no pun intended) one of the bugs reported by Gregor in id:87edxw8jp4.fsf@no.workgroup --- test/T450-emacs-show.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh index 37940c96..2cebd43d 100755 --- a/test/T450-emacs-show.sh +++ b/test/T450-emacs-show.sh @@ -350,6 +350,15 @@ file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1) subject=$(grep '^Subject:' $file) test_expect_equal "$output" "$subject" +FILE3=$(notmuch search --output=files --duplicate=3 "id:${ID3}") +test_begin_subtest "duplicate=3, stash" +test_subtest_known_broken +test_emacs_expect_t \ + "(notmuch-show \"id:${ID3}\") + (notmuch-show-choose-duplicate 3) + (notmuch-show-stash-filename) + (notmuch-test-expect-equal (list (car kill-ring)) (list \"${FILE3}\"))" + test_begin_subtest "duplicate=0" test_emacs "(test-log-error (notmuch-show \"id:${ID3}\") -- 2.35.2
This fixes one of the bugs reported by Gregor in [1]. [1]: id:87edxw8jp4.fsf@no.workgroup --- emacs/notmuch-show.el | 4 ++-- test/T450-emacs-show.sh | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 1bc3b319..527db4bb 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1811,10 +1811,10 @@ current thread." ;; dme: Would it make sense to use a macro for many of these? -;; XXX TODO figure out what to do about multiple filenames (defun notmuch-show-get-filename () "Return the filename of the current message." - (car (notmuch-show-get-prop :filename))) + (let ((duplicate (or (notmuch-show-get-prop :duplicate) 1))) + (nth (1- duplicate) (notmuch-show-get-prop :filename)))) (defun notmuch-show-get-header (header &optional props) "Return the named header of the current message, if any." diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh index 2cebd43d..ab611d56 100755 --- a/test/T450-emacs-show.sh +++ b/test/T450-emacs-show.sh @@ -352,7 +352,6 @@ test_expect_equal "$output" "$subject" FILE3=$(notmuch search --output=files --duplicate=3 "id:${ID3}") test_begin_subtest "duplicate=3, stash" -test_subtest_known_broken test_emacs_expect_t \ "(notmuch-show \"id:${ID3}\") (notmuch-show-choose-duplicate 3) -- 2.35.2
This duplicates one of the bugs reported by Gregor in [1]. [1]: id:87edxw8jp4.fsf@no.workgroup --- test/T450-emacs-show.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh index ab611d56..83e902f1 100755 --- a/test/T450-emacs-show.sh +++ b/test/T450-emacs-show.sh @@ -381,4 +381,15 @@ test_emacs "(notmuch-show \"id:${ID3}\") (test-visible-output \"OUTPUT\")" 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) + (test-visible-output \"OUTPUT\")" +subject4=$(grep '^Subject:' $FILE4) +subject=$(grep '^Subject:' OUTPUT) +test_expect_equal "$subject4" "$subject" + test_done -- 2.35.2
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
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
David Bremner <david@tethera.net> writes:
> This duplicates (no pun intended) one of the bugs reported by Gregor
> in id:87edxw8jp4.fsf@no.workgroup
applied all 5 patches in this thread to master.
d