mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
emacs: Fix saved-search buffer titles
REPRODUCTION STEPS: (let ((notmuch-saved-searches (list (list :name "Emacs List" :query "query:lists-emacs") (list :name "All Lists" :query "query:lists")))) (notmuch-search-buffer-title "query:lists-emacs" )) ACTUAL: "*notmuch-saved-search-[ All Lists ]-emacs*" EXPECTED: "*notmuch-saved-search-Emacs List*"
This commit is contained in:
parent
a8ba7c59a4
commit
bc98920917
1 changed files with 14 additions and 11 deletions
|
@ -973,17 +973,20 @@ unthreaded) and whether it's SAVED (t or nil)."
|
||||||
(defun notmuch-search-buffer-title (query &optional type)
|
(defun notmuch-search-buffer-title (query &optional type)
|
||||||
"Returns the title for a buffer with notmuch search results."
|
"Returns the title for a buffer with notmuch search results."
|
||||||
(let* ((saved-search
|
(let* ((saved-search
|
||||||
(let (longest
|
(cl-loop with match
|
||||||
(longest-length 0))
|
with match-length = 0
|
||||||
(cl-loop for tuple in notmuch-saved-searches
|
for candidate in notmuch-saved-searches
|
||||||
if (let ((quoted-query
|
for length = (let* ((query* (notmuch-saved-search-get
|
||||||
(regexp-quote
|
candidate
|
||||||
(notmuch-saved-search-get tuple :query))))
|
:query))
|
||||||
(and (string-match (concat "^" quoted-query) query)
|
(regexp (concat "^"
|
||||||
(> (length (match-string 0 query))
|
(regexp-quote query*))))
|
||||||
longest-length)))
|
(and (string-match regexp query)
|
||||||
do (setq longest tuple))
|
(length (match-string 0 query))))
|
||||||
longest))
|
if (and length (> length match-length))
|
||||||
|
do (setq match candidate
|
||||||
|
match-length length)
|
||||||
|
finally return match))
|
||||||
(saved-search-name (notmuch-saved-search-get saved-search :name))
|
(saved-search-name (notmuch-saved-search-get saved-search :name))
|
||||||
(saved-search-type (notmuch-saved-search-get saved-search :search-type))
|
(saved-search-type (notmuch-saved-search-get saved-search :search-type))
|
||||||
(saved-search-query (notmuch-saved-search-get saved-search :query)))
|
(saved-search-query (notmuch-saved-search-get saved-search :query)))
|
||||||
|
|
Loading…
Reference in a new issue