[PATCH] Try to provide search buffers with titles from notmuch-folders.

Servilio Afre Puentes servilio at gmail.com
Thu Apr 15 05:16:09 PDT 2010


---
 emacs/notmuch.el |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index be09f42..17e0e86 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -696,6 +696,15 @@ characters as well as `_.+-'.
     (apply 'notmuch-call-notmuch-process "tag"
 	   (append action-split (list notmuch-search-query-string) nil))))

+(defun notmuch-search-buffer-title (query)
+  "Returns the title for a buffer with notmuch search results."
+  (let ((folder (car (rassoc query notmuch-folders))))
+       (if folder
+	   (concat "*notmuch-folder-" folder "*")
+	 (concat "*notmuch-search-" query "*"))
+       )
+)
+
 ;;;###autoload
 (defun notmuch-search (query &optional oldest-first target-thread target-line)
   "Run \"notmuch search\" with the given query string and display results.
@@ -708,7 +717,7 @@ The optional parameters are used as follows:
   target-line: The line number to move to if the target thread does not
                appear in the search results."
   (interactive "sNotmuch search: ")
-  (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*"))))
+  (let ((buffer (get-buffer-create (notmuch-search-buffer-title query))))
     (switch-to-buffer buffer)
     (notmuch-search-mode)
     (set 'notmuch-search-query-string query)
-- 
1.7.0.4


More information about the notmuch mailing list