[RFC PATCH v3 07/11] emacs: add entry to notmuch-pick from notmuch.el

Subject: [RFC PATCH v3 07/11] emacs: add entry to notmuch-pick from notmuch.el

Date: Mon, 13 Feb 2012 01:20:11 +0000

To: notmuch@notmuchmail.org

Cc:

From: Mark Walters


Add bindings 'z' to enter a notmuch-pick search and 'Z' to go straight
to the current search (i.e. the on being viewed in notmuch.el buffer)
in notmuch-pick. Also add binding `M-RET' to view the currently selected
thread with notmuch-pick.
---
 emacs/notmuch.el |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b4f1c5..28f7953 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -54,6 +54,7 @@
 
 (require 'notmuch-lib)
 (require 'notmuch-show)
+(require 'notmuch-pick)
 (require 'notmuch-mua)
 (require 'notmuch-hello)
 (require 'notmuch-maildir-fcc)
@@ -272,6 +273,8 @@ For a mouse binding, return nil."
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "m" 'notmuch-mua-new-mail)
     (define-key map "s" 'notmuch-search)
+    (define-key map "z" 'notmuch-pick)
+    (define-key map "Z" 'notmuch-search-pick-current-query)
     (define-key map "o" 'notmuch-search-toggle-order)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "=" 'notmuch-search-refresh-view)
@@ -284,6 +287,7 @@ For a mouse binding, return nil."
     (define-key map "-" 'notmuch-search-remove-tag)
     (define-key map "+" 'notmuch-search-add-tag)
     (define-key map (kbd "RET") 'notmuch-search-show-thread)
+    (define-key map (kbd "M-RET") 'notmuch-search-pick-thread)
     map)
   "Keymap for \"notmuch search\" buffers.")
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
@@ -1021,6 +1025,22 @@ same relative position within the new buffer."
     (notmuch-search query oldest-first target-thread target-line continuation)
     (goto-char (point-min))))
 
+(defun notmuch-search-pick-current-query ()
+  "Call notmuch pick with the current query"
+  (interactive)
+  (notmuch-pick notmuch-search-query-string))
+
+(defun notmuch-search-pick-thread ()
+  "Show the selected thread with notmuch-pick"
+  (interactive)
+  (notmuch-pick (notmuch-search-find-thread-id)
+		notmuch-search-query-string
+		(notmuch-prettify-subject (notmuch-search-find-subject)))
+  (unless (notmuch-pick-get-match)
+    (notmuch-pick-next-message))
+  (notmuch-pick-show-message))
+
+
 (defcustom notmuch-poll-script nil
   "An external script to incorporate new mail into the notmuch database.
 
-- 
1.7.2.3


Thread: