unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH v3] completion: complete notmuch emacs-mua
Date: Sun, 27 Nov 2016 11:29:24 +0200	[thread overview]
Message-ID: <1480238964-15998-1-git-send-email-jani@nikula.org> (raw)
In-Reply-To: <a301fbdeec1d4ab492ee02595ec17fa2b5a3eff1.1479762655.git.jani@nikula.org>

With subcommand handling for external commands we can easily complete
'notmuch emacs-mua' using the existing completion system.

---

v3: complete --hello option
---
 completion/notmuch-completion.bash | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
index d44b2a2811f0..40012eaaffd9 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -236,6 +236,38 @@ _notmuch_dump()
     esac
 }
 
+_notmuch_emacs_mua()
+{
+    local cur prev words cword split
+    _init_completion -s || return
+
+    $split &&
+    case "${prev}" in
+	--to|--cc|--bcc)
+	    COMPREPLY=( $(compgen -W "`_notmuch_email to:${cur}`" -- ${cur}) )
+	    return
+	    ;;
+	--body)
+	    _filedir
+	    return
+	    ;;
+    esac
+
+    ! $split &&
+    case "${cur}" in
+        -*)
+	    local options="--subject= --to= --cc= --bcc= --body= --no-window-system --client --auto-daemon --create-frame --print --help --hello"
+
+	    compopt -o nospace
+	    COMPREPLY=( $(compgen -W "$options" -- ${cur}) )
+	    ;;
+	*)
+	    COMPREPLY=( $(compgen -W "`_notmuch_email to:${cur}`" -- ${cur}) )
+	    return
+	    ;;
+    esac
+}
+
 _notmuch_insert()
 {
     local cur prev words cword split
@@ -496,7 +528,7 @@ _notmuch_tag()
 
 _notmuch()
 {
-    local _notmuch_commands="compact config count dump help insert new reply restore search address setup show tag"
+    local _notmuch_commands="compact config count dump help insert new reply restore search address setup show tag emacs-mua"
     local arg cur prev words cword split
 
     # require bash-completion with _init_completion
-- 
2.1.4

  reply	other threads:[~2016-11-27  9:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 21:13 [PATCH v2 0/9] improvements around notmuch-emacs-mua Jani Nikula
2016-11-21 21:13 ` [PATCH v2 1/9] completion: complete notmuch emacs-mua Jani Nikula
2016-11-27  9:29   ` Jani Nikula [this message]
2016-11-21 21:13 ` [PATCH v2 2/9] man: advertize notmuch-emacs-mua as notmuch emacs-mua subcommand Jani Nikula
2016-11-21 21:13 ` [PATCH v2 3/9] emacs: move notmuch-emacs-mua under emacs Jani Nikula
2016-11-21 21:13 ` [PATCH v2 4/9] notmuch-emacs-mua: add --hello parameter Jani Nikula
2016-11-25 16:34   ` Tomi Ollila
2016-11-21 21:13 ` [PATCH v2 5/9] build: install notmuch-emacs-mua with notmuch-emacs Jani Nikula
2016-11-21 21:13 ` [PATCH v2 6/9] notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop Jani Nikula
2016-11-26 12:53   ` David Bremner
2016-11-21 21:13 ` [PATCH v2 7/9] emacs/desktop: update to use notmuch-emacs-mua and handle mailto Jani Nikula
2016-11-21 21:13 ` [PATCH v2 8/9] build: install notmuch-emacs-mua.desktop file with emacs Jani Nikula
2016-11-25 16:39   ` Tomi Ollila
2016-11-26  9:37     ` [PATCH v3] " Jani Nikula
2016-11-26 17:07       ` Tomi Ollila
2016-11-29  2:09       ` David Bremner
2016-11-21 21:13 ` [PATCH v2 9/9] build: update the desktop database after installing the desktop file Jani Nikula
2016-11-26  9:43   ` [PATCH v3] " Jani Nikula
2016-11-29  2:10     ` 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=1480238964-15998-1-git-send-email-jani@nikula.org \
    --to=jani@nikula.org \
    --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).