unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] completion: fail silently if _init_completion is not found
@ 2014-08-18 16:33 Jani Nikula
  2014-08-18 17:24 ` Tomi Ollila
  2014-08-23  0:08 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Jani Nikula @ 2014-08-18 16:33 UTC (permalink / raw)
  To: notmuch

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

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

end of thread, other threads:[~2014-08-23  0:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-18 16:33 [PATCH] completion: fail silently if _init_completion is not found Jani Nikula
2014-08-18 17:24 ` Tomi Ollila
2014-08-23  0:08 ` 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).