zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: autoload path completion with expansions
Date: Tue, 7 Sep 2021 16:04:22 -0700	[thread overview]
Message-ID: <CAH+w=7Y+pBEYQszH=4Lwx+m5veGwNmP9-3dmEFYYZSSNU-xnkg@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7ZpZ1FUen4PinnO8RvqmwrPp0U+Kb_NJZ9pxdaDP1P3vw@mail.gmail.com>

On Sun, Sep 5, 2021 at 11:54 AM Bart Schaefer <schaefer@brasslantern.com> 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.


      reply	other threads:[~2021-09-07 23:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05 18:54 Bart Schaefer
2021-09-07 23:04 ` Bart Schaefer [this message]

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='CAH+w=7Y+pBEYQszH=4Lwx+m5veGwNmP9-3dmEFYYZSSNU-xnkg@mail.gmail.com' \
    --to=schaefer@brasslantern.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).