Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Something rotten in tar completion



(This mail wanted me to reply to

To: Zsh Hackers' List <zsh-workers@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

and I got a message in Korean telling me the mail server wasn't happy.
Well, I think.  Not sure if that's a clue to other mail problems.  I
don't mean the Korean.)

On Thu, 04 Dec 2014 08:56:06 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Dec 2,  5:26pm, Peter Stephenson wrote:
> }
> } Turns out it was recursive-files.  I had that set for my "src"
> } subdirectory, which was a bit daft since it's got to search through any old
> } clutter to find a completion for a bare file name.  Removing that
> } removes the wait.
> } 
> } Would still be nice to be able to kill it...
> 
> In the most recent _main_complete, the message on the interrupt should
> tell you where it was:
> 
> trap 'zle -M "Killed by signal in ${funcstack[1]} after ${SECONDS}s";
> 
> Getting that $funcstack name might be helpful.

It's always in _files or _path_files --- kind of where you'd expect from
the code you quoted.  I guess it's the glob that's not very
interruptible.

> In the meantime, it does
> not seem useful to regenerate the recursive listing for every directory
> in the recursive-files style:

Can I suggest only generating subtree if we have a matching file?

diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index 0f6fcd6..e628cb3 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -121,9 +121,13 @@ for def in "$pats[@]"; do
           if _path_files -g "$pat" "$opts[@]" "$expl[@]"; then
 	    ret=0
 	  elif [[ $PREFIX$SUFFIX != */* ]] && zstyle -a
":completion:${curcontext}:$tag" recursive-files rfiles; then
+	    local subtree
 	    for rfile in $rfiles; do
 	      if [[ $PWD/ = ${~rfile} ]]; then
-		for prepath in **/*(/); do
+		if [[ -z $subtree ]]; then
+		  subtree=( **/*(/) )
+		fi
+		for prepath in $subtree; do
 		  oprefix=$PREFIX
 		  PREFIX=$prepath/$PREFIX
 		  _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0

pws



Messages sorted by: Reverse Date, Date, Thread, Author