mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
completion: use mail_root for path completion in bash/zsh
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.
This commit is contained in:
parent
f9ffc5f433
commit
d99b0d4dc8
2 changed files with 7 additions and 7 deletions
|
@ -103,12 +103,12 @@ _notmuch_search_terms()
|
||||||
COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_email ${cur}`" -- ${cur##from:}) )
|
COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_email ${cur}`" -- ${cur##from:}) )
|
||||||
;;
|
;;
|
||||||
path:*)
|
path:*)
|
||||||
local path=`notmuch config get database.path`
|
local path=`notmuch config get database.mail_root`
|
||||||
compopt -o nospace
|
compopt -o nospace
|
||||||
COMPREPLY=( $(compgen -d "$path/${cur##path:}" | sed "s|^$path/||" ) )
|
COMPREPLY=( $(compgen -d "$path/${cur##path:}" | sed "s|^$path/||" ) )
|
||||||
;;
|
;;
|
||||||
folder:*)
|
folder:*)
|
||||||
local path=`notmuch config get database.path`
|
local path=`notmuch config get database.mail_root`
|
||||||
compopt -o nospace
|
compopt -o nospace
|
||||||
COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \
|
COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \
|
||||||
sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
|
sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
|
||||||
|
@ -281,7 +281,7 @@ _notmuch_insert()
|
||||||
$split &&
|
$split &&
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
--folder)
|
--folder)
|
||||||
local path=`notmuch config get database.path`
|
local path=`notmuch config get database.mail_root`
|
||||||
compopt -o nospace
|
compopt -o nospace
|
||||||
COMPREPLY=( $(compgen -d "$path/${cur}" | \
|
COMPREPLY=( $(compgen -d "$path/${cur}" | \
|
||||||
sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
|
sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
|
||||||
|
|
|
@ -69,8 +69,8 @@ _notmuch_term_mimetype() {
|
||||||
|
|
||||||
_notmuch_term_path() {
|
_notmuch_term_path() {
|
||||||
local ret=1 expl
|
local ret=1 expl
|
||||||
local maildir="$(notmuch config get database.path)"
|
local maildir="$(notmuch config get database.mail_root)"
|
||||||
[[ -d $maildir ]] || { _message -e "database.path not found" ; return $ret }
|
[[ -d $maildir ]] || { _message -e "database.mail_root not found" ; return $ret }
|
||||||
|
|
||||||
_description notmuch-folder expl 'maildir folder'
|
_description notmuch-folder expl 'maildir folder'
|
||||||
_files "$expl[@]" -W $maildir -/ && ret=0
|
_files "$expl[@]" -W $maildir -/ && ret=0
|
||||||
|
@ -79,8 +79,8 @@ _notmuch_term_path() {
|
||||||
|
|
||||||
_notmuch_term_folder() {
|
_notmuch_term_folder() {
|
||||||
local ret=1 expl
|
local ret=1 expl
|
||||||
local maildir="$(notmuch config get database.path)"
|
local maildir="$(notmuch config get database.mail_root)"
|
||||||
[[ -d $maildir ]] || { _message -e "database.path not found" ; return $ret }
|
[[ -d $maildir ]] || { _message -e "database.mail_root not found" ; return $ret }
|
||||||
|
|
||||||
_description notmuch-folder expl 'maildir folder'
|
_description notmuch-folder expl 'maildir folder'
|
||||||
local ignoredfolders=( '*/(cur|new|tmp)' )
|
local ignoredfolders=( '*/(cur|new|tmp)' )
|
||||||
|
|
Loading…
Reference in a new issue