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

Re: When you know completion will be slow ...



On Feb 7, 12:21pm, Peter Stephenson wrote:
} Subject: Re: When you know completion will be slow ...
}
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > The "zle -M" command works from inside a completion widget, and will erase
} > the completion listing (which is then redrawn), so it could be used to
} > display a message just before the long operation begins.
} 
} Do you know about the show-completer style?  It's not quite the same
} thing but by the same token that means you get information even if you
} don't know in advance completion's going to be slow.

I had forgotten about it, having played with it for a while way back when
you first added it and then left it alone.

I just tried it again and I find the context it displays is not specific
enough, but you're right that it does at least tell you that something is
happening.

However, using "zle -R" gives me bad behavior.  Starting from Src/zsh -f:

------------
torch% autoload -U compinit; compinit -D
torch% _deliberately_slow() { sleep 5; return 1; }
torch% zstyle ':completion:*' completer _deliberately_slow _complete
torch% zstyle ':completion:*' show-completer yes
torch% ls 
Trying completion for :completion::deliberately-slow::
------------

Becomes

------------
torch% ls
Config/               config.modules.sh     Makefile
config.h              config.status*        Src/
config.log            Doc/                  stamp-h
config.modules        Etc/                  Test/
config.modules.local  foo/
------------

and if I then press TAB again I get

------------
torch% ls
Trying completion for :completion::deliberately-slow::
config.h              config.status*        Src/
config.log            Doc/                  stamp-h
config.modules        Etc/                  Test/
config.modules.local  foo/
------------

which then becomes

------------
torch% ls Config/

config.h              config.status*        Src/                
config.log            Doc/                  stamp-h             
config.modules        Etc/                  Test/               
config.modules.local  foo/
------------

Oops, the first line of the completion listing is not redrawn.  This
does not happen with "zle -M".



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