]> git.notmuchmail.org Git - notmuch/commitdiff
completion: use mail_root for path completion in bash/zsh
authorCédric Hannotier <cedric.hannotier@ulb.be>
Thu, 16 Dec 2021 17:40:53 +0000 (18:40 +0100)
committerDavid Bremner <david@tethera.net>
Mon, 3 Jan 2022 12:07:38 +0000 (08:07 -0400)
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
completion/zsh/_notmuch

index 15425697a215290e79a4d58e7cdf4884f3a5f2bc..0022b54bff5df41765aecdd640484a6dd53b5e5f 100644 (file)
@@ -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\)$" ) )
index e920f10b2363dedba6e712bec26f75ebbcfce600..e207d90b72020f0a94fa46c72702a34a6a1ddc35 100644 (file)
@@ -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)' )