emacs: tree: use message pane decryption state for replies

This makes replying to a message in tree view, use the decrypted state
from the message pane if it is open. Previously it just used the
global decryption state from notmuch-crypto-process-mime.

In particular if notmuch-crypto-process-mime is nil, and the user
views the messages (which doesn't decrypt), toggles decryption in the
message pane, and then replies, the reply will be decrypted.
This commit is contained in:
Mark Walters 2016-09-21 16:49:19 +01:00 committed by David Bremner
parent 8a20400490
commit e5786283e7

View file

@ -209,6 +209,13 @@ open (if the message pane is closed it does nothing)."
(with-selected-window notmuch-tree-message-window
(call-interactively #',func)))))
(defun notmuch-tree-inherit-from-message-pane (sym)
"Return value of SYM in message-pane if open, or tree-pane if not"
(if (window-live-p notmuch-tree-message-window)
(with-selected-window notmuch-tree-message-window
(symbol-value sym))
(symbol-value sym)))
(defun notmuch-tree-button-activate (&optional button)
"Activate BUTTON or button at point
@ -226,8 +233,10 @@ FUNC."
`(lambda ()
,(concat "(Close message pane and) " (documentation func t))
(interactive)
(let ((notmuch-show-process-crypto
(notmuch-tree-inherit-from-message-pane 'notmuch-show-process-crypto)))
(notmuch-tree-close-message-window)
(call-interactively #',func)))
(call-interactively #',func))))
(defvar notmuch-tree-mode-map
(let ((map (make-sparse-keymap)))