zsh-workers
 help / color / mirror / 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
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

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ https://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git