unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] completion: complete notmuch emacs-mua
@ 2017-02-25  9:25 Jani Nikula
  2017-02-25  9:25 ` [PATCH 2/2] emacs/desktop: update to use notmuch-emacs-mua and handle mailto Jani Nikula
  2017-03-01 23:43 ` [PATCH 1/2] completion: complete notmuch emacs-mua David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Jani Nikula @ 2017-02-25  9:25 UTC (permalink / raw)
  To: notmuch

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

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

end of thread, other threads:[~2017-03-01 23:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-25  9:25 [PATCH 1/2] completion: complete notmuch emacs-mua Jani Nikula
2017-02-25  9:25 ` [PATCH 2/2] emacs/desktop: update to use notmuch-emacs-mua and handle mailto Jani Nikula
2017-03-01 23:43 ` [PATCH 1/2] completion: complete notmuch emacs-mua 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).