From d8d1112ce4ed5a16b74a1f951701be8225b68c7d Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Mon, 18 Aug 2014 19:33:21 +0300 Subject: [PATCH] [PATCH] completion: fail silently if _init_completion is not found --- 30/a57a9de8c3348f57cae8d2ee5781283309171a | 104 ++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 30/a57a9de8c3348f57cae8d2ee5781283309171a diff --git a/30/a57a9de8c3348f57cae8d2ee5781283309171a b/30/a57a9de8c3348f57cae8d2ee5781283309171a new file mode 100644 index 000000000..dc4cbc836 --- /dev/null +++ b/30/a57a9de8c3348f57cae8d2ee5781283309171a @@ -0,0 +1,104 @@ +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 1AB22431FAE + for ; Mon, 18 Aug 2014 09:33:42 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 YYC2Oh4cBkat for ; + Mon, 18 Aug 2014 09:33:34 -0700 (PDT) +Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com + [209.85.212.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 01BC7431FBC + for ; Mon, 18 Aug 2014 09:33:28 -0700 (PDT) +Received: by mail-wi0-f171.google.com with SMTP id hi2so4022748wib.10 + for ; Mon, 18 Aug 2014 09:33:26 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id; + bh=byi9LzKAig0HNDZfVDvvdvNxJNTbrzEPmDu+sJwRKJ4=; + b=RJG0t0426M3jMz/FR/Vhp6ik/+OrY3NXGOp5W/1zrLGoCqFYc8d3MY/1D+hUko3pG8 + Vc6CZqzKd2pqj3Bc15lCjidvUdHDEpZpHfIb9mShtn3iYe4DKYJJr5Rcu3GDEc25LkAh + ae0aPZhKoHknyyKVGHBJrZMvkkU4trsR7bea9EcQil7+gC5IzThRxw8+2enTjmPbrGFk + vmmTBBcvtrrvJYKLUZV8blC/3QLWIxZJLR9G6i1L6/kGozcM8lb+IcR86Cq/Ey+p3Ha2 + Z6Uf7QdnAYBVrQCKN10DdgvKnJjL+V2J/obCfDzKpJKZcGNrhA0nFjiF2K+kkZtiCGfh + tQog== +X-Gm-Message-State: + ALoCoQldgG2JOeSAqGLHEsQaBuTd/aAXcsvBfCLUb1LafyPL/v5CfBp2AZXQNHarn46+vVwn6ULC +X-Received: by 10.180.19.1 with SMTP id a1mr205174wie.16.1408379605676; + Mon, 18 Aug 2014 09:33:25 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c374-75.dhcp.inet.fi. + [88.195.116.75]) by mx.google.com with ESMTPSA id + do6sm39372967wib.22.2014.08.18.09.33.23 for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 18 Aug 2014 09:33:24 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH] completion: fail silently if _init_completion is not found +Date: Mon, 18 Aug 2014 19:33:21 +0300 +Message-Id: <1408379601-31994-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 2.0.1 +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 16:33:42 -0000 + +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 +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 + -- 2.26.2