mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
emacs: Tweak search-buffer naming to search list in reverse order
The complete-string matching of commit
f2ebe3ac44
defeats the substitution of partial search
strings when the user manually types a
long search string that just happens to
partially match a saved search.
For example, typing "tag:inbox and not tag:foo"
should result in "[inbox] and not tag:foo" but
this has been broken since that commit.
As a compromise between this feature and what the
commit was trying to achieve, we now reverse the
saved-searches list before looking for a match.
This happens to work for me, but won't necessarily
work in general.
What we really want is the longest match, but rassoc-if
just gives us the first match. All of this is just about
creating slightly nice search-buffer names. So if anyone
really cares about making the names *even* nicer, then
they could improve this further.
This commit is contained in:
parent
6731ab1037
commit
0d8e26d0e3
1 changed files with 2 additions and 2 deletions
|
@ -663,9 +663,9 @@ characters as well as `_.+-'.
|
|||
(defun notmuch-search-buffer-title (query)
|
||||
"Returns the title for a buffer with notmuch search results."
|
||||
(let* ((saved-search (rassoc-if (lambda (key)
|
||||
(string-match (concat "^" (regexp-quote key) "$")
|
||||
(string-match (concat "^" (regexp-quote key))
|
||||
query))
|
||||
(notmuch-saved-searches)))
|
||||
(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))
|
||||
|
|
Loading…
Reference in a new issue