]> git.cworth.org Git - notmuch/commitdiff
emacs: tree: use message pane decryption state for replies
authorMark Walters <markwalters1009@gmail.com>
Wed, 21 Sep 2016 15:49:19 +0000 (16:49 +0100)
committerDavid Bremner <david@tethera.net>
Wed, 2 Nov 2016 10:45:28 +0000 (07:45 -0300)
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.

emacs/notmuch-tree.el

index 220c010dfbfa61e4f01d37961055176f69c1fa37..62064ce1d682ad4a5c3a44aefaa4363dad81f596 100644 (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)
-     (notmuch-tree-close-message-window)
-     (call-interactively #',func)))
+     (let ((notmuch-show-process-crypto
+           (notmuch-tree-inherit-from-message-pane 'notmuch-show-process-crypto)))
+       (notmuch-tree-close-message-window)
+       (call-interactively #',func))))
 
 (defvar notmuch-tree-mode-map
   (let ((map (make-sparse-keymap)))