]> git.notmuchmail.org Git - notmuch/commitdiff
contrib: pick: override notmuch-show-get-prop
authorMark Walters <markwalters1009@gmail.com>
Thu, 22 Aug 2013 17:10:16 +0000 (18:10 +0100)
committerDavid Bremner <bremner@debian.org>
Sat, 24 Aug 2013 09:15:23 +0000 (11:15 +0200)
We override notmuch-show-get-prop so that many of the show functions
can be used in notmuch-pick without modification. The main use is that
it means notmuch-show-get-message-id `works' in pick. Thus we get all
the stash functions and several other `for free' in pick.

contrib/notmuch-pick/notmuch-pick.el

index 7f5f729a55aee73f5d352c538c291d405ac2f830..04e37ee59a1e5a15abbdba152909aabadcff0962 100644 (file)
@@ -238,6 +238,22 @@ Some useful entries are:
     (beginning-of-line)
     (get-text-property (point) :notmuch-message-properties)))
 
     (beginning-of-line)
     (get-text-property (point) :notmuch-message-properties)))
 
+;; XXX This should really be a lib function but we are trying to
+;; reduce impact on the code base.
+(defun notmuch-show-get-prop (prop &optional props)
+  "This is a pick overridden version of notmuch-show-get-prop
+
+It gets property PROP from PROPS or, if PROPS is nil, the current
+message in either pick or show. This means that several functions
+in notmuch-show now work unchanged in pick as they just need the
+correct message properties."
+  (let ((props (or props
+                  (cond ((eq major-mode 'notmuch-show-mode)
+                         (notmuch-show-get-message-properties))
+                        ((eq major-mode 'notmuch-pick-mode)
+                         (notmuch-pick-get-message-properties))))))
+    (plist-get props prop)))
+
 (defun notmuch-pick-set-message-properties (props)
   (save-excursion
     (beginning-of-line)
 (defun notmuch-pick-set-message-properties (props)
   (save-excursion
     (beginning-of-line)