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.

I think it makes sense to include in the reply what the user can see,
and only falling back on global defaults when needed.

However, the extra complexity for a rather extreme corner case (see
example in the commit message) may mean it's not worth doing.

Best wishes


emacs/notmuch-tree.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 8285354..e35d382 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -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))
-     (notmuch-tree-close-message-window)
-     (call-interactively #',func)))
+     (let ((notmuch-show-process-crypto
+           (notmuch-tree-inherit-from-message-pane 
+       (notmuch-tree-close-message-window)
+       (call-interactively #',func))))
 (defvar notmuch-tree-mode-map
   (let ((map (make-sparse-keymap)))

notmuch mailing list

Reply via email to