Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1D1F7431FBD for ; Mon, 24 Mar 2014 14:14:26 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pCo4PU9nb0Nv for ; Mon, 24 Mar 2014 14:14:18 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id B4DF1431FB6 for ; Mon, 24 Mar 2014 14:14:18 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 4B7FB1000E5; Mon, 24 Mar 2014 23:14:14 +0200 (EET) From: Tomi Ollila To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH 1/2] completion: add proper completion of folder: and path: In-Reply-To: <1394656429-1409-1-git-send-email-jani@nikula.org> References: <1394656429-1409-1-git-send-email-jani@nikula.org> User-Agent: Notmuch/0.17+156~g1203750 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Mar 2014 21:14:26 -0000 On Wed, Mar 12 2014, Jani Nikula 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