Re: [PATCH] Fix saved-search buffer titles

Subject: Re: [PATCH] Fix saved-search buffer titles

Date: Tue, 06 Aug 2024 06:41:20 -0300

To: Rudolf Adamkovič, notmuch@notmuchmail.org

Cc:

From: David Bremner


Rudolf Adamkovič <salutis@me.com> writes:

> From c0cb08a843b5c904642da639f94c4a5e43d1ef14 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
> Date: Wed, 13 Dec 2023 22:39:02 +0100
> Subject: [PATCH] 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*"

If you can make a reproducer that does not rely on your private notmuch
config (query:list), I might be able to turn that into a test.

> +	  (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))

Sorry, I don't really speak cl-loop. You can either hope someone else
reviews it and convinces me, or try a less intrusive restructuring of
the existing code.


_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: