unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] completion: add proper completion of folder: and path:
@ 2014-03-12 20:33 Jani Nikula
  2014-03-12 20:33 ` [PATCH 2/2] completion: complete directory parameters to directories only Jani Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jani Nikula @ 2014-03-12 20:33 UTC (permalink / raw)
  To: notmuch

Complete folder: to maildir folders and path: to directories in mail
store.
---
 completion/notmuch-completion.bash | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
index 0f132043dea5..59f1a3ea6431 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -49,8 +49,19 @@ _notmuch_search_terms()
 	from:*)
 	    COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_user_emails`" -- ${cur##from:}) )
 	    ;;
+	path:*)
+	    local path=`notmuch config get database.path`
+	    compopt -o nospace
+	    COMPREPLY=( $(compgen -d "$path/${cur##path:}" | sed "s|^$path/||" ) )
+	    ;;
+	folder:*)
+	    local path=`notmuch config get database.path`
+	    compopt -o nospace
+	    COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \
+		sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
+	    ;;
 	*)
-	    local search_terms="from: to: subject: attachment: tag: id: thread: folder: date:"
+	    local search_terms="from: to: subject: attachment: tag: id: thread: folder: path: date:"
 	    compopt -o nospace
 	    COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) )
 	    ;;
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] completion: complete directory parameters to directories only
  2014-03-12 20:33 [PATCH 1/2] completion: add proper completion of folder: and path: Jani Nikula
@ 2014-03-12 20:33 ` Jani Nikula
  2014-03-24 21:14 ` [PATCH 1/2] completion: add proper completion of folder: and path: Tomi Ollila
  2014-03-26  0:34 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2014-03-12 20:33 UTC (permalink / raw)
  To: notmuch

i.e. don't complete to files if only directories are acceptable.
---
 completion/notmuch-completion.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
index 59f1a3ea6431..d88c5e7d965e 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -78,7 +78,7 @@ _notmuch_compact()
     $split &&
     case "${prev}" in
 	--backup)
-	    _filedir
+	    _filedir -d
 	    return
 	    ;;
     esac
@@ -107,7 +107,7 @@ _notmuch_config()
 	    ;;
 	# these will also complete on config get, but we don't care
 	database.path)
-	    _filedir
+	    _filedir -d
 	    ;;
 	maildir.synchronize_flags)
 	    COMPREPLY=( $(compgen -W "true false" -- ${cur}) )
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] completion: add proper completion of folder: and path:
  2014-03-12 20:33 [PATCH 1/2] completion: add proper completion of folder: and path: Jani Nikula
  2014-03-12 20:33 ` [PATCH 2/2] completion: complete directory parameters to directories only Jani Nikula
@ 2014-03-24 21:14 ` Tomi Ollila
  2014-03-26  0:34 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2014-03-24 21:14 UTC (permalink / raw)
  To: Jani Nikula, notmuch

On Wed, Mar 12 2014, Jani Nikula <jani@nikula.org> wrote:

> Complete folder: to maildir folders and path: to directories in mail
> store.
> ---

Series LGTM.


Tomi


COMPREPLY=( $(cd $path; compgen -d "${cur#path:}") ) might also work but...

>  completion/notmuch-completion.bash | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
> index 0f132043dea5..59f1a3ea6431 100644
> --- a/completion/notmuch-completion.bash
> +++ b/completion/notmuch-completion.bash
> @@ -49,8 +49,19 @@ _notmuch_search_terms()
>  	from:*)
>  	    COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_user_emails`" -- ${cur##from:}) )
>  	    ;;
> +	path:*)
> +	    local path=`notmuch config get database.path`
> +	    compopt -o nospace
> +	    COMPREPLY=( $(compgen -d "$path/${cur##path:}" | sed "s|^$path/||" ) )
> +	    ;;
> +	folder:*)
> +	    local path=`notmuch config get database.path`
> +	    compopt -o nospace
> +	    COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \
> +		sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
> +	    ;;
>  	*)
> -	    local search_terms="from: to: subject: attachment: tag: id: thread: folder: date:"
> +	    local search_terms="from: to: subject: attachment: tag: id: thread: folder: path: date:"
>  	    compopt -o nospace
>  	    COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) )
>  	    ;;
> -- 
> 1.9.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] completion: add proper completion of folder: and path:
  2014-03-12 20:33 [PATCH 1/2] completion: add proper completion of folder: and path: Jani Nikula
  2014-03-12 20:33 ` [PATCH 2/2] completion: complete directory parameters to directories only Jani Nikula
  2014-03-24 21:14 ` [PATCH 1/2] completion: add proper completion of folder: and path: Tomi Ollila
@ 2014-03-26  0:34 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2014-03-26  0:34 UTC (permalink / raw)
  To: Jani Nikula, notmuch

Jani Nikula <jani@nikula.org> writes:

> Complete folder: to maildir folders and path: to directories in mail
> store.

series pushed,

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-26  0:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-12 20:33 [PATCH 1/2] completion: add proper completion of folder: and path: Jani Nikula
2014-03-12 20:33 ` [PATCH 2/2] completion: complete directory parameters to directories only Jani Nikula
2014-03-24 21:14 ` [PATCH 1/2] completion: add proper completion of folder: and path: Tomi Ollila
2014-03-26  0:34 ` David Bremner

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).