From: Tomi Ollila Date: Mon, 18 Aug 2014 17:24:33 +0000 (+0300) Subject: Re: [PATCH] completion: fail silently if _init_completion is not found X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8f239a871a998e446e747e40cef8472bf6453a18;hp=d8d1112ce4ed5a16b74a1f951701be8225b68c7d;p=notmuch-archives.git Re: [PATCH] completion: fail silently if _init_completion is not found --- diff --git a/f9/d40f93745b91c59603cff3160dafe33563659a b/f9/d40f93745b91c59603cff3160dafe33563659a new file mode 100644 index 000000000..dc2a88929 --- /dev/null +++ b/f9/d40f93745b91c59603cff3160dafe33563659a @@ -0,0 +1,105 @@ +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 177C8431FBC + for ; Mon, 18 Aug 2014 10:25:00 -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 3lz49LhVpfnW for ; + Mon, 18 Aug 2014 10:24:52 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 9499F431FAE + for ; Mon, 18 Aug 2014 10:24:52 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id A01B61000C1; + Mon, 18 Aug 2014 20:24:33 +0300 (EEST) +From: Tomi Ollila +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH] completion: fail silently if _init_completion is not + found +In-Reply-To: <1408379601-31994-1-git-send-email-jani@nikula.org> +References: <1408379601-31994-1-git-send-email-jani@nikula.org> +User-Agent: Notmuch/0.18.1+76~g581776d (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, 18 Aug 2014 17:25:00 -0000 + +On Mon, Aug 18 2014, Jani Nikula wrote: + +> The completion script depends on bash-completion 1.90 or later, with +> _init_completion function. If that's not present, for some reason, the +> completion currently fails with an ugly message, messing up user's +> command line: +> +> $ notmuch -bash: _init_completion: command not found +> +> It's better to just not complete +> +> --- + +LGTM. + +Tomi + + +> +> This is probably unnecessary since +> +> commit aff5af582ecbacb4004ad306c6ef463d61f1ed3a +> Author: Jani Nikula +> Date: Sun Feb 2 18:47:57 2014 +0200 +> +> configure: only install bash completion if supported +> +> but should not do harm. +> --- +> completion/notmuch-completion.bash | 4 ++++ +> 1 file changed, 4 insertions(+) +> +> diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash +> index d88c5e7d965e..0571dc9da8e3 100644 +> --- a/completion/notmuch-completion.bash +> +++ b/completion/notmuch-completion.bash +> @@ -395,6 +395,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=() +> -- +> 2.0.1 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch