]> git.notmuchmail.org Git - notmuch/commitdiff
contrib: pick: add in to-message-window function
authorMark Walters <markwalters1009@gmail.com>
Thu, 22 Aug 2013 17:10:20 +0000 (18:10 +0100)
committerDavid Bremner <bremner@debian.org>
Sat, 24 Aug 2013 09:16:58 +0000 (11:16 +0200)
contrib/notmuch-pick/notmuch-pick.el

index 89e6d4b7965d79d41f01ec21e52466ec62f3f954..9c1864b2c115f7b7750ea2f9fcfb16195489017e 100644 (file)
@@ -187,6 +187,19 @@ if the user has loaded a different buffer in that window.")
 (make-variable-buffer-local 'notmuch-pick-message-buffer)
 (put 'notmuch-pick-message-buffer 'permanent-local t)
 
 (make-variable-buffer-local 'notmuch-pick-message-buffer)
 (put 'notmuch-pick-message-buffer 'permanent-local t)
 
+(defun notmuch-pick-to-message-pane (func)
+  "Execute FUNC in message pane.
+
+This function returns a function (so can be used as a keybinding)
+which executes function FUNC in the message pane if it is
+open (if the message pane is closed it does nothing)."
+  `(lambda ()
+      ,(concat "(In message pane) " (documentation func t))
+     (interactive)
+     (when (window-live-p notmuch-pick-message-window)
+       (with-selected-window notmuch-pick-message-window
+        (call-interactively #',func)))))
+
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'notmuch-pick-show-message)
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'notmuch-pick-show-message)