]> git.cworth.org Git - notmuch/commitdiff
emacs: update notmuch-show-get-filename to handle duplicates
authorDavid Bremner <david@tethera.net>
Thu, 4 Aug 2022 11:08:33 +0000 (08:08 -0300)
committerDavid Bremner <david@tethera.net>
Sun, 7 Aug 2022 10:05:49 +0000 (07:05 -0300)
This fixes one of the bugs reported by Gregor in [1].

[1]: id:87edxw8jp4.fsf@no.workgroup

emacs/notmuch-show.el
test/T450-emacs-show.sh

index 1bc3b3196ecdf8331fbee59d83c3058db4fae1d8..527db4bbc0ff346572bdf34f97830264ac7dad38 100644 (file)
@@ -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."
index 2cebd43d3b58dd2a5ccaa2b9db3f7b1e87ecaafb..ab611d5645a87bd23495467d3efdaff28d5c74da 100755 (executable)
@@ -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)