aboutsummaryrefslogtreecommitdiff
path: root/emacs/notmuch.el
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2024-08-09 10:18:54 -0300
committerDavid Bremner <david@tethera.net>2024-08-09 10:18:54 -0300
commit4e85abda157eac8888809b2dde885f60f312a5fb (patch)
tree9cb440c445df3103db6cd38f9b6ff4a2afe93ed2 /emacs/notmuch.el
parentbf9b9fe0469d24d1f0924074ffd5904363cb49cc (diff)
Revert "emacs: Fix saved-search buffer titles"
This reverts commit bc989209171d406b3671024542e59b86b0ecb23d. This was applied unintentionally to master while still under discussion.
Diffstat (limited to 'emacs/notmuch.el')
-rw-r--r--emacs/notmuch.el25
1 files changed, 11 insertions, 14 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f55e9b42..2a73ffa5 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -973,20 +973,17 @@ unthreaded) and whether it's SAVED (t or nil)."
(defun notmuch-search-buffer-title (query &optional type)
"Returns the title for a buffer with notmuch search results."
(let* ((saved-search
- (cl-loop with match
- with match-length = 0
- for candidate in notmuch-saved-searches
- for length = (let* ((query* (notmuch-saved-search-get
- candidate
- :query))
- (regexp (concat "^"
- (regexp-quote query*))))
- (and (string-match regexp query)
- (length (match-string 0 query))))
- if (and length (> length match-length))
- do (setq match candidate
- match-length length)
- finally return match))
+ (let (longest
+ (longest-length 0))
+ (cl-loop for tuple in notmuch-saved-searches
+ if (let ((quoted-query
+ (regexp-quote
+ (notmuch-saved-search-get tuple :query))))
+ (and (string-match (concat "^" quoted-query) query)
+ (> (length (match-string 0 query))
+ longest-length)))
+ do (setq longest tuple))
+ longest))
(saved-search-name (notmuch-saved-search-get saved-search :name))
(saved-search-type (notmuch-saved-search-get saved-search :search-type))
(saved-search-query (notmuch-saved-search-get saved-search :query)))