Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: autoload path completion with expansions
- X-seq: zsh-workers 49389
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: autoload path completion with expansions
- Date: Tue, 7 Sep 2021 16:04:22 -0700
- Archived-at: <https://zsh.org/workers/49389>
- In-reply-to: <CAH+w=7ZpZ1FUen4PinnO8RvqmwrPp0U+Kb_NJZ9pxdaDP1P3vw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7ZpZ1FUen4PinnO8RvqmwrPp0U+Kb_NJZ9pxdaDP1P3vw@mail.gmail.com>
On Sun, Sep 5, 2021 at 11:54 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> + if [[ $PREFIX[1] = [$/~] ]] && _files; then
> # Autoload by absolute path
Turns out this doesn't do the right thing when $PREFIX contains a
valid relative directory name (such as "." or ".." among other
things).
Slightly different patch against the original source.
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index d3304bed0..058842378 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -101,9 +101,9 @@ if [[ "$state" = vars_eq ]]; then
elif (( $+opt_args[-w] )); then
_wanted files expl 'zwc file' _files -g '*.zwc(-.)' && ret=0
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
- if [[ $PREFIX[1] = [/~] ]]; then
+ if [[ ${"${(e)PREFIX}"[1]} = [/~] ]] && _files; then
# Autoload by absolute path
- _files && ret=0
+ ret=0
else
args=(${^fpath}/*(-.:t))
# Filter out functions already loaded or marked for autoload.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author