From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH] completion: fail silently if _init_completion is not found
Date: Mon, 18 Aug 2014 19:33:21 +0300 [thread overview]
Message-ID: <1408379601-31994-1-git-send-email-jani@nikula.org> (raw)
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
---
This is probably unnecessary since
commit aff5af582ecbacb4004ad306c6ef463d61f1ed3a
Author: Jani Nikula <jani@nikula.org>
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
next reply other threads:[~2014-08-18 16:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 16:33 Jani Nikula [this message]
2014-08-18 17:24 ` [PATCH] completion: fail silently if _init_completion is not found Tomi Ollila
2014-08-23 0:08 ` 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=1408379601-31994-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).