From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] _subversion: Don't cache an empty commands list when svn is not available at the first invocation of _svn.
Date: Tue, 25 Jul 2017 14:11:49 +0000 [thread overview]
Message-ID: <20170725141149.28147-1-danielsh@tarpaulin.shahaf.local2> (raw)
---
This affects the following use-case:
% svn <TAB><prints "No matches">^C
% ${PACKAGEMANAGER} install subversion
% svn <TAB>
Before the patch it would cache the "No matches", with the patch it invokes svn
again.
Cheers,
Daniel
Completion/Unix/Command/_subversion | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index 640c88950..2f6b567ac 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -36,7 +36,12 @@ _svn () {
_svn_cmds=(
${=${(f)${${"$(_comp_locale; _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
)
- _store_cache svn-cmds _svn_cmds
+ if (( $? == 0 )); then
+ _store_cache svn-cmds _svn_cmds
+ else
+ # Ensure we enter this block again on the next <TAB>.
+ unset _svn_cmds
+ fi
fi
fi
reply other threads:[~2017-07-25 14:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170725141149.28147-1-danielsh@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.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://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).