zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: globcomplete desctroys file completion
Date: Sat, 21 Feb 2009 11:16:23 -0800	[thread overview]
Message-ID: <090221111624.ZM12907@torch.brasslantern.com> (raw)
In-Reply-To: <slrngq038s.2hh.joerg@alea.gnuu.de>

On Feb 21,  2:18pm, Jorg wrote:
}
} when I set the option globcomplete, file completion doesn't work in all
} cases.

Based just on the _complete_debug output you sent, I'd say that the
correct thing is happening WITH globcomplete, and without it you're
somehow getting disambiguation that you shouldn't.

For example, T*/t*/t* should among other files match Tmp/texlive/tlpkg
and Tmp/texlive2008/tlpkg, but when you complete without globcomplete
you're offered Tmp/texlive/te as a unique prefix.  How can that be
correct?
 
} % zsh -f
} ibook% autoload -Uz compinit
} ibook% compinit

You might try using "compinit -D" here when testing, to avoid reading
an existing zcompdump file.  Probably doesn't matter here.

} ibook% print -l T/t/t<TAB>          --> Tmp/texlive/te
} ibook% setopt globcomplete 
} ibook% print -l T/t/t<TAB>          --> nothing, failure
} % zsh --version
} zsh 4.3.9 (powerpc-unknown-linux-gnu)
} 
} A log for this is available at
} http://alioth.debian.org/~jo-guest/zsh5117print1

What is helpful in these cases is TWO logs, e.g. one with globcomplete
set and the other with globcomplete NOT set, for comparison.

I created the set of files shown at _path_files:449 in your debug trace:

schaefer<513> print -C 2 T*/t*/t*
Tmp/texlive2008/texmf            Tmp/texlive/texmf
Tmp/texlive2008/texmf-dist       Tmp/texlive/texmf.cnf
Tmp/texlive2008/texmf-doc        Tmp/texlive/texmf-config
Tmp/texlive2008/texmf-var        Tmp/texlive/texmf-dist
Tmp/texlive2008/tlpkg            Tmp/texlive/texmf-doc
Tmp/texlive2008/tl-portable      Tmp/texlive/texmf-local
Tmp/texlive2008/tl-portable.bat  Tmp/texlive/texmf-var
Tmp/texlive/temp                 Tmp/texlive/tlpkg
schaefer<514> zsh -f
torch% autoload -Uz compinit
torch% compinit -D
torch% print T/t/t<C-x?>
torch% print Tmp/texlive/t
                        ^
			cursor is here, on the slash, because
			texlive is ambiguous with texlive2008
torch% setopt globcomplete
torch% print T/t/t<C-x?>
Trace output left in /tmp/zsh12830print2 (up-history to view)
torch% print T/t/t<C-d>
texlive/      texlive2008/

Interesting.  Comparing the traces I find that at _path_files:238 with
globcomplete, menu=yes is being set, and at _path_files:623 the value
of $compstate[pattern_match] is "*" so the code branches to line 667
instead of 629.  This sends us around the (for i in "$tmp1[@]"; do)
loop at line 673 a bunch of times, each time adding either "texlive"
or "texlive2008" as a completion with a different path tail as a hidden
suffix.  When we finally get to the end of _path_files at line 813,
$compstate[nmatches] is greater than zero so _path_files returns 1.

I'm not sure why an empty $compstate[pattern_match] means that the
function should behave as if NOT inserting the match into the command
line (see comments around lines 627 and 666), but that's what causes
the "correct" branch at 621-623.  It also seems to be the case that
xtrace output is omitting short-circuited branches of conditionals
when printing, which makes it hard to follow the and/or logic in the
trace.

-- 


  reply	other threads:[~2009-02-21 19:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-21 14:18 Jörg Sommer
2009-02-21 19:16 ` Bart Schaefer [this message]
2009-02-22  0:57   ` Bart Schaefer
2009-02-25 20:39     ` Peter Stephenson
2009-02-25 20:48       ` Peter Stephenson
2009-02-26  0:24         ` Jörg Sommer
2009-02-26  1:30         ` Bart Schaefer
2009-02-26  4:12           ` Bart Schaefer
2009-02-26 10:49             ` Peter Stephenson
2009-02-22 20:36   ` Jörg Sommer
2009-02-23  2:25     ` Bart Schaefer

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=090221111624.ZM12907@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).