X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=7549fbb2d32643d79a2483ba7b2906920aa0ae3e;hb=3c1ad5bfa0039191f1202b0542eb3af7afd16c5c;hp=b8e24bc7816f1b7c68926ea03bf2dc12b36d54d9;hpb=2e1eee3a77114465a3ad4872067a41caa2c1221d;p=notmuch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index b8e24bc7..7549fbb2 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -46,6 +46,7 @@ (declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp)) (declare-function notmuch-tree "notmuch-tree" (&optional query query-context target buffer-name open-target)) +(declare-function notmuch-tree-get-message-properties "notmuch-tree" nil) (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date") "Headers that should be shown in a message, in this order. @@ -1203,6 +1204,15 @@ This includes: - the current message." (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages))) +(defun notmuch-show-get-query () + "Return the current query in this show buffer" + (if notmuch-show-query-context + (concat notmuch-show-thread-id + " and (" + notmuch-show-query-context + ")") + notmuch-show-thread-id)) + (defun notmuch-show-apply-state (state) "Apply STATE to the current buffer. @@ -1465,8 +1475,18 @@ an error if there is no part containing point." (notmuch-show-set-message-properties props))) (defun notmuch-show-get-prop (prop &optional props) + "Get property PROP from current message in show or tree mode. + +It gets property PROP from PROPS or, if PROPS is nil, the current +message in either tree or show. This means that several utility +functions in notmuch-show can be used directly by notmuch-tree as +they just need the correct message properties." (let ((props (or props - (notmuch-show-get-message-properties)))) + (cond ((eq major-mode 'notmuch-show-mode) + (notmuch-show-get-message-properties)) + ((eq major-mode 'notmuch-tree-mode) + (notmuch-tree-get-message-properties)) + (t nil))))) (plist-get props prop))) (defun notmuch-show-get-message-id (&optional bare)