[PATCH] completion: Add support for custom header prefixes

2024-01-16 Thread Per Modin
Append custom search query prefixes, if any, to the standard set of
terms used for searching. Applies to both bash and zsh, and is checked
with Awk and GNU Awk.
---
 completion/notmuch-completion.bash | 4 
 completion/zsh/_notmuch| 3 +++
 2 files changed, 7 insertions(+)

diff --git a/completion/notmuch-completion.bash 
b/completion/notmuch-completion.bash
index 3748846e..cb363719 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -123,6 +123,10 @@ _notmuch_search_terms()
;;
*)
local search_terms="from: to: subject: attachment: mimetype: tag: 
id: thread: folder: path: date: lastmod: query: property:"
+
+   # append custom search terms, if any
+   search_terms="${search_terms}$(notmuch config list | awk -F'[.=]' 
'/index\.header\./ { printf " %s:", $3 }')"
+
compopt -o nospace
COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) )
;;
diff --git a/completion/zsh/_notmuch b/completion/zsh/_notmuch
index 0bdd7f77..d779ceb5 100644
--- a/completion/zsh/_notmuch
+++ b/completion/zsh/_notmuch
@@ -112,6 +112,9 @@ _notmuch_search_term() {
 'from' 'to' 'subject' 'attachment' 'mimetype' 'tag' 'id' 'thread' 'path' 
'folder' 'date' 'lastmod' 'query' 'property'
   )
 
+  # append custom search terms, if any
+  notmuch_search_terms+=("${(@f)$(notmuch config list | awk -F'[.=]' 
'/index\.header\./ { print $3 }')}")
+
   if compset -P '(#b)([^:]#):'; then
 if (( $+functions[_notmuch_term_$match[1]] )); then
   _notmuch_term_$match[1] && ret=0
-- 
2.43.0

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 1/3] CLI/git: remove unused import

2024-01-16 Thread David Bremner
Jakub Wilk  writes:

> shutil was used only for the tempfile.TemporaryDirectory backport,
> which was removed in commit b7c31f658121a0cf ("CLI/git: drop support for
> python < 3.2").

Series applied to master.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org