From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATH: autoload with explicit path
Date: Wed, 11 Jan 2017 21:13:54 +0000 [thread overview]
Message-ID: <20170111211354.636986a0@ntlworld.com> (raw)
In-Reply-To: <20170111114232.04eedd08@pwslap01u.europe.root.pri>
Completion for this.
Didn't really understand what I was doing here, but it seems to work...
pws
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index 94f63cf..0961e98 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -21,6 +21,7 @@ allargs=(
X '+X[immediately autoload function]'
Z "($fopts -A -E -F -i)-Z+[right justify and fill with leading zeros]:width"
a "($fopts -A -E -F -T -i)-a[specify that arguments refer to arrays]"
+ df "-d[default absolute path autoload to fpath]"
f "($popts)-f[specify that arguments refer to functions]"
g "($fopts -T)-+g[do not restrict parameter to local scope]"
h "($fopts -T)-+h[hide specialness of parameter]"
@@ -31,6 +32,8 @@ allargs=(
m '(-A -E -F -T -i)-m[treat arguments as patterns]'
p '-p[output parameters in form of calls to typeset]'
r '(-f)-+r[mark parameters as readonly]'
+ rf '-r[remember autoload path]'
+ Rf '-R[remember autoload path, error if not found]'
t '(-T)-+t[tag parameters and turn on execution tracing for functions]'
tf '(-T)-+t[turn on execution tracing for functions]'
tp '(-T)-+t[tag parameters]'
@@ -46,7 +49,7 @@ use="AEFHLRTUZafghiklmprtuxz"
case ${service} in
autoload)
- use="UTXktwz"
+ use="URTXdkrtwz"
func=f
;;
float) use="EFHghlprtux";;
@@ -74,7 +77,7 @@ onopts=${(j..)${${words[1,CURRENT-1]:#^-*}##-}}
offopts=${(j..)${${words[1,CURRENT-1]:#^+*}##+}}
for ((i=1;i<=$#use;++i)); do
- args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[UutT]]:+$func}]} )
+ args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[dUurRtT]]:+$func}]} )
done
_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq'
@@ -90,12 +93,17 @@ if [[ "$state" = vars_eq ]]; then
elif (( $+opt_args[-w] )); then
_wanted files expl 'zwc file' _files -g '*.zwc(-.)'
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
- args=(${^fpath}/*(-.:t))
- # Filter out functions already loaded or marked for autoload.
- local -a funckeys
- funckeys=(${(k)functions})
- args=(${args:|funckeys})
- _wanted functions expl 'shell function' compadd -a args
+ if [[ $PREFIX[1] = / ]]; then
+ # Autoload by absolute path
+ _files
+ else
+ args=(${^fpath}/*(-.:t))
+ # Filter out functions already loaded or marked for autoload.
+ local -a funckeys
+ funckeys=(${(k)functions})
+ args=(${args:|funckeys})
+ _wanted functions expl 'shell function' compadd -a args
+ fi
elif [[ -n $onopts$offopts ]]; then
if [[ -n $offopts ]]; then
args=(${(f)"$(functions +${offopts//[^UXkmtTuz]/})"})
next prev parent reply other threads:[~2017-01-11 21:14 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-11 22:18 Peter Stephenson
2016-12-12 16:05 ` Bart Schaefer
2016-12-12 16:31 ` Peter Stephenson
2016-12-12 18:09 ` Bart Schaefer
2017-01-10 19:31 ` Peter Stephenson
2017-01-11 11:42 ` Peter Stephenson
2017-01-11 20:51 ` Peter Stephenson
2017-01-12 20:42 ` Peter Stephenson
2017-01-13 18:04 ` Peter Stephenson
2017-01-16 10:37 ` Peter Stephenson
2017-01-16 15:04 ` Daniel Shahaf
2017-01-16 15:48 ` Peter Stephenson
2017-01-16 15:22 ` Bart Schaefer
2017-01-16 15:59 ` Peter Stephenson
[not found] ` <CAHYJk3SB1NDj6y5TRHHsAVsyjHfZQhTzMRzTR2c-SVEc9oAwzA@mail.gmail.com>
2017-01-24 11:10 ` Peter Stephenson
2017-01-11 21:13 ` Peter Stephenson [this message]
2017-01-17 18:36 ` PATCH: " Peter Stephenson
2017-01-17 22:17 ` Daniel Shahaf
2017-01-18 0:06 ` Bart Schaefer
2017-01-18 9:21 ` Peter Stephenson
2017-01-18 9:17 ` Peter Stephenson
2017-01-18 22:26 ` Bart Schaefer
2017-01-19 9:39 ` Peter Stephenson
2017-01-18 9:53 ` Peter Stephenson
[not found] <CGME20170127151334epcas2p4c32b57f69fcae22b40b309793eb8ceb6@epcas2p4.samsung.com>
2017-01-27 15:12 ` PATH: " Sebastian Gniazdowski
2017-01-27 16:24 ` Peter Stephenson
2017-01-27 18:40 ` Sebastian Gniazdowski
2017-01-27 18:44 ` Peter Stephenson
2017-01-27 19:00 ` Sebastian Gniazdowski
2017-01-28 18:05 ` Bart Schaefer
2017-01-28 19:12 ` Peter Stephenson
2017-01-28 19:45 ` Bart Schaefer
2017-01-28 19:56 ` Peter Stephenson
2017-01-28 20:37 ` Sebastian Gniazdowski
2017-01-29 12:27 ` Sebastian Gniazdowski
2017-01-29 16:11 ` Bart Schaefer
2017-01-29 17:32 ` Sebastian Gniazdowski
2017-01-29 18:37 ` Bart Schaefer
2017-01-29 21:53 ` Vin Shelton
2017-01-30 10:06 ` Peter Stephenson
2017-01-29 17:58 ` Peter Stephenson
2017-01-30 11:37 ` Sebastian Gniazdowski
2017-01-30 11:55 ` Peter Stephenson
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=20170111211354.636986a0@ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--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).