bash completion error with 0.17

Jani Nikula jani at nikula.org
Sun Feb 2 04:54:29 PST 2014


On Sun, 02 Feb 2014, Jani Nikula <jani at nikula.org> wrote:
> The trivial "fix" patch would likely just check for the existence of
> _init_completion, and refuse to complete without it. For anything
> fancier, patches welcome...

The patch below would get rid of the error message (and completion, for
that matter) when _init_completion is not present.

I'm not sure whether this is the way to go, or should we rather check
for a recent enough bash-completion during configure, or
recommend/suggest it, or what. The error message does tell us what's
wrong, although it's annoying for the user (probably more so than just
not completing).

BR,
Jani.



diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
index 0f13204..0c457a8 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -384,6 +384,10 @@ _notmuch()
 {
     local _notmuch_commands="compact config count dump help insert new reply restore search setup show tag"
     local arg cur prev words cword split
+
+    # require bash-completion with _init_completion
+    type -t _init_completion >/dev/null 2>&1 || return
+
     _init_completion || return
 
     COMPREPLY=()


More information about the notmuch mailing list