From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22160 invoked by alias); 11 Jan 2017 21:14:00 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40332 Received: (qmail 2610 invoked from network); 11 Jan 2017 21:14:00 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-10.server.virginmedia.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(80.0.253.74):SA:0(-1.2/5.0):. Processed in 1.04042 secs); 11 Jan 2017 21:14:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _smtprelay.virginmedia.com designates 80.0.253.74 as permitted sender) X-Originating-IP: [86.21.219.59] X-Spam: 0 X-Authority: v=2.1 cv=WM+CJSYR c=1 sm=1 tr=0 a=utowdAHh8RITBM/6U1BPxA==:117 a=utowdAHh8RITBM/6U1BPxA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=MWUjAzoEKyAA:10 a=biwJsuGI9NA01kqLVXwA:9 a=CjuIK1q_8ugA:10 Date: Wed, 11 Jan 2017 21:13:54 +0000 From: Peter Stephenson To: Zsh hackers list Subject: Re: PATH: autoload with explicit path Message-ID: <20170111211354.636986a0@ntlworld.com> In-Reply-To: <20170111114232.04eedd08@pwslap01u.europe.root.pri> References: <20161211221844.5e51affe@ntlworld.com> <161212080550.ZM935@torch.brasslantern.com> <20161212163124.6654f077@pwslap01u.europe.root.pri> <20170110193102.7725620a@ntlworld.com> <20170111114232.04eedd08@pwslap01u.europe.root.pri> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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]/})"})