unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: "Cédric Hannotier" <cedric.hannotier@ulb.be>
To: notmuch@notmuchmail.org
Cc: "Cédric Hannotier" <cedric.hannotier@ulb.be>
Subject: [PATCH 2/2] completion: use mail_root for path completion in bash/zsh
Date: Thu, 16 Dec 2021 18:40:53 +0100	[thread overview]
Message-ID: <20211216174053.706313-2-cedric.hannotier@ulb.be> (raw)
In-Reply-To: <20211216174053.706313-1-cedric.hannotier@ulb.be>

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

  reply	other threads:[~2021-12-16 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 17:40 [PATCH 1/2] doc: mail store is given by database.mail_root Cédric Hannotier
2021-12-16 17:40 ` Cédric Hannotier [this message]
2022-01-03 12:25 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211216174053.706313-2-cedric.hannotier@ulb.be \
    --to=cedric.hannotier@ulb.be \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).