[PATCH 05/11] contrib: pick: add in to-message-window function

Mark Walters markwalters1009 at gmail.com
Fri Jul 5 11:11:12 PDT 2013


This would be very simple but we want to get a useful doc string (so
we get useful help messages).

We use this for tabbing between and activate buttons in the message
pane but it is trivial for pick or the user to link in other
functions. For example

(define-key map "h" (notmuch-pick-to-message-pane #'notmuch-show-toggle-visibility-headers))

Other plausible functions for linking are

notmuch-show-toggle-elide-non-matching
notmuch-show-toggle-process-crypto
notmuch-show-toggle-thread-indentation
toggle-truncate-lines
---
 contrib/notmuch-pick/notmuch-pick.el |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 7313100..8251b35 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -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)
 
+(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
+	 (funcall #',func)))))
+
 (defvar notmuch-pick-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mouse-1] 'notmuch-pick-show-message)
-- 
1.7.9.1



More information about the notmuch mailing list