[PATCH 2/2] completion: use mail_root for path completion in bash/zsh

Subject: [PATCH 2/2] completion: use mail_root for path completion in bash/zsh

Date: Thu, 16 Dec 2021 18:40:53 +0100

To: notmuch@notmuchmail.org

Cc: Cédric Hannotier

From: Cédric Hannotier


Since mail store and database directory can be different,
path and folder completions must use the directory given by
database.mail_root, not by database.path.
---
 completion/notmuch-completion.bash | 6 +++---
 completion/zsh/_notmuch            | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
index 15425697..0022b54b 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -103,12 +103,12 @@ _notmuch_search_terms()
 	    COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_email ${cur}`" -- ${cur##from:}) )
 	    ;;
 	path:*)
-	    local path=`notmuch config get database.path`
+	    local path=`notmuch config get database.mail_root`
 	    compopt -o nospace
 	    COMPREPLY=( $(compgen -d "$path/${cur##path:}" | sed "s|^$path/||" ) )
 	    ;;
 	folder:*)
-	    local path=`notmuch config get database.path`
+	    local path=`notmuch config get database.mail_root`
 	    compopt -o nospace
 	    COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \
 		sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
@@ -281,7 +281,7 @@ _notmuch_insert()
     $split &&
     case "${prev}" in
 	--folder)
-	    local path=`notmuch config get database.path`
+	    local path=`notmuch config get database.mail_root`
 	    compopt -o nospace
 	    COMPREPLY=( $(compgen -d "$path/${cur}" | \
 		sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
diff --git a/completion/zsh/_notmuch b/completion/zsh/_notmuch
index e920f10b..e207d90b 100644
--- a/completion/zsh/_notmuch
+++ b/completion/zsh/_notmuch
@@ -69,8 +69,8 @@ _notmuch_term_mimetype() {
 
 _notmuch_term_path() {
   local ret=1 expl
-  local maildir="$(notmuch config get database.path)"
-  [[ -d $maildir ]] || { _message -e "database.path not found" ; return $ret }
+  local maildir="$(notmuch config get database.mail_root)"
+  [[ -d $maildir ]] || { _message -e "database.mail_root not found" ; return $ret }
 
   _description notmuch-folder expl 'maildir folder'
   _files "$expl[@]" -W $maildir -/ && ret=0
@@ -79,8 +79,8 @@ _notmuch_term_path() {
 
 _notmuch_term_folder() {
   local ret=1 expl
-  local maildir="$(notmuch config get database.path)"
-  [[ -d $maildir ]] || { _message -e "database.path not found" ; return $ret }
+  local maildir="$(notmuch config get database.mail_root)"
+  [[ -d $maildir ]] || { _message -e "database.mail_root not found" ; return $ret }
 
   _description notmuch-folder expl 'maildir folder'
   local ignoredfolders=( '*/(cur|new|tmp)' )
-- 
2.34.1

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

Thread: