From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] _compdef: Use zsh/param instead of a glob.
Date: Sun, 26 Aug 2018 10:54:04 +0000 [thread overview]
Message-ID: <20180826105404.31846-1-danielsh@tarpaulin.shahaf.local2> (raw)
In particular, this allows functions defined inside another file to be
offered, such as various __git_foo() helpers defined in ${^fpath}/_git.
---
Completion/Zsh/Command/_compdef | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Completion/Zsh/Command/_compdef b/Completion/Zsh/Command/_compdef
index 7a64da835..003c37da3 100644
--- a/Completion/Zsh/Command/_compdef
+++ b/Completion/Zsh/Command/_compdef
@@ -1,6 +1,6 @@
#compdef compdef
-local state line expl list disp curcontext="$curcontext" pat normal ret=1
+local state line expl disp curcontext="$curcontext" pat normal ret=1
local args1 args2
typeset -A opt_args
@@ -57,7 +57,8 @@ case $state in
_wanted commands expl 'completed command' compadd -k _comps && ret=0
;;
cfun)
- list=( ${^fpath:/.}/_(|*[^~])(:t) )
+ typeset -aU list=( ${(k)functions[(I)_*]} )
+ (( ${+list[1]} )) || list+=( ${^fpath:/.}/_(|*[^~])(:t) )
if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then
disp=( ${list[@]#_} )
_wanted functions expl 'completion function' \
next reply other threads:[~2018-08-26 10:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-26 10:54 Daniel Shahaf [this message]
2018-08-27 1:09 ` Matthew Martin
2018-08-27 10:07 ` Daniel Shahaf
2018-08-27 18:22 ` Bart Schaefer
2018-08-27 18:47 ` Daniel Shahaf
2018-08-27 19:07 ` Bart Schaefer
2018-09-03 13:44 ` [PATCH v2] _compdef: Change and add sources for completed completion function names Daniel Shahaf
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=20180826105404.31846-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).