X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch.el;h=57e11400a526cf4b81433430d1ce0f65245f989d;hp=9b2b5924e856bfc973564c531f9310d9a3516e32;hb=417274d698b6718621b9f5dec744ab169499f4e3;hpb=a4669217600e4536dc0c49f0255af5e2d9bc183f diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 9b2b5924..57e11400 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -56,6 +56,7 @@ (require 'notmuch-mua) (require 'notmuch-hello) (require 'notmuch-maildir-fcc) +(require 'notmuch-message) (defcustom notmuch-search-result-format `(("date" . "%s ") @@ -662,19 +663,19 @@ characters as well as `_.+-'. (defun notmuch-search-buffer-title (query) "Returns the title for a buffer with notmuch search results." - (let* ((folder (rassoc-if (lambda (key) - (string-match (concat "^" (regexp-quote key)) - query)) - (notmuch-saved-searches))) - (folder-name (car folder)) - (folder-query (cdr folder))) - (cond ((and folder (equal folder-query query)) - ;; Query is the same as folder search (ignoring case) - (concat "*notmuch-folder-" folder-name "*")) - (folder + (let* ((saved-search (rassoc-if (lambda (key) + (string-match (concat "^" (regexp-quote key)) + query)) + (reverse (notmuch-saved-searches)))) + (saved-search-name (car saved-search)) + (saved-search-query (cdr saved-search))) + (cond ((and saved-search (equal saved-search-query query)) + ;; Query is the same as saved search (ignoring case) + (concat "*notmuch-saved-search-" saved-search-name "*")) + (saved-search (concat "*notmuch-search-" - (replace-regexp-in-string (concat "^" (regexp-quote folder-query)) - (concat "[ " folder-name " ]") + (replace-regexp-in-string (concat "^" (regexp-quote saved-search-query)) + (concat "[ " saved-search-name " ]") query) "*")) (t