Thanks Jani. I've just looked at the bash-completion formula on Homebrew. It says that bash-completion 2.0 and above needs bash4, but the current version of OSX, 10.9, still has bash 3.2, which is why, at least under Homebrew, we can't update bash-completion to the latest version.

I think your patch probably makes sense. Once a user updates to a newer bash-completion, it will just begin working, while for users like me, the error message goes away.


On 2 February 2014 13:54, Jani Nikula <jani@nikula.org> wrote:
On Sun, 02 Feb 2014, Jani Nikula <jani@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=()