mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
emacs: tree/show remove duplicate function
tree overrides notmuch-show-get-prop so that it can use many of the utility function directly. Now that tree is in mainline the version from tree can be moved to show and the original overridden show version dropped.
This commit is contained in:
parent
4697e86a52
commit
ebb58751dc
2 changed files with 11 additions and 17 deletions
|
@ -46,6 +46,7 @@
|
||||||
(declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp))
|
(declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp))
|
||||||
(declare-function notmuch-tree "notmuch-tree"
|
(declare-function notmuch-tree "notmuch-tree"
|
||||||
(&optional query query-context target buffer-name open-target))
|
(&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")
|
(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
|
||||||
"Headers that should be shown in a message, in this order.
|
"Headers that should be shown in a message, in this order.
|
||||||
|
@ -1474,8 +1475,17 @@ an error if there is no part containing point."
|
||||||
(notmuch-show-set-message-properties props)))
|
(notmuch-show-set-message-properties props)))
|
||||||
|
|
||||||
(defun notmuch-show-get-prop (prop &optional 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
|
(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))))))
|
||||||
(plist-get props prop)))
|
(plist-get props prop)))
|
||||||
|
|
||||||
(defun notmuch-show-get-message-id (&optional bare)
|
(defun notmuch-show-get-message-id (&optional bare)
|
||||||
|
|
|
@ -290,22 +290,6 @@ Some useful entries are:
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(get-text-property (point) :notmuch-message-properties)))
|
(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 tree view overridden version of notmuch-show-get-prop
|
|
||||||
|
|
||||||
It gets property PROP from PROPS or, if PROPS is nil, the current
|
|
||||||
message in either tree or show. This means that several functions
|
|
||||||
in notmuch-show now work unchanged in tree 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-tree-mode)
|
|
||||||
(notmuch-tree-get-message-properties))))))
|
|
||||||
(plist-get props prop)))
|
|
||||||
|
|
||||||
(defun notmuch-tree-set-message-properties (props)
|
(defun notmuch-tree-set-message-properties (props)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
|
|
Loading…
Reference in a new issue