]> git.cworth.org Git - notmuch/commitdiff
emacs/show: provide a more friendly function to get duplicate num
authorDavid Bremner <david@tethera.net>
Thu, 4 Aug 2022 11:48:07 +0000 (08:48 -0300)
committerDavid Bremner <david@tethera.net>
Sun, 7 Aug 2022 10:05:49 +0000 (07:05 -0300)
There is not much code here, but at least we can fix the indexing as 1
based.

emacs/notmuch-show.el

index 527db4bbc0ff346572bdf34f97830264ac7dad38..e9a9ac2cc08c6e00dd7a0e18fa8a1f61430c071a 100644 (file)
@@ -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))