[PATCH 10/11] emacs: add function to toggle showing authors/recipients in search

Subject: [PATCH 10/11] emacs: add function to toggle showing authors/recipients in search

Date: Sun, 19 Aug 2012 18:52:49 -0700

To: Notmuch Mail

Cc:

From: Jameson Graef Rollins


New function, notmuch-search-toggle-tofrom, toggles whether thread
authors or recipients are shown in the 'authors' fields in the search
results.  This is bound to the '/' key.
---
 emacs/notmuch.el |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index d05b1e8..ca16583 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -226,6 +226,7 @@ For a mouse binding, return nil."
     (define-key map "m" 'notmuch-mua-new-mail)
     (define-key map "s" 'notmuch-search)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "/" 'notmuch-search-toggle-tofrom)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "=" 'notmuch-search-refresh-view)
     (define-key map "G" 'notmuch-search-poll-and-refresh-view)
@@ -1082,6 +1083,16 @@ search."
   (set 'notmuch-search-oldest-first (not notmuch-search-oldest-first))
   (notmuch-search-refresh-view))
 
+(defun notmuch-search-toggle-tofrom ()
+  "Toggle showing thread authors or recipients.
+
+By default, search results display the authors of the threads in
+the \"authors\" field.  This command toggles the display of
+thread recipients in that field instead."
+  (interactive)
+  (set 'notmuch-search-show-recipients (not notmuch-search-show-recipients))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-filter (query)
   "Filter the current search results based on an additional query string.
 
-- 
1.7.10.4


Thread: