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

Re: reverse-menu-complete re-starting completion on 5.2?

On Wed, Mar 9, 2016 at 12:12 PM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On Mon, Mar 7, 2016 at 3:05 AM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> On Sun, Mar 6, 2016 at 6:41 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>> Meant to respond to this a while ago ...
>>> On Feb 29,  1:45am, Oliver Kiddle wrote:
>>> }
>>> } Even before that commit I can reproduce a variant of the problem by
>>> } starting menu completion with reverse-menu-complete and then switching
>>> } to a forwards menu complete.
>>> Not surprising, really.
>>> } [...] I'm really not sure why we need to be so
>>> } strict about the completion widget matching the last completion widget.
>>> The only reason I can think of is in case menu completion is invoked from
>>> within a user-defined widget, or otherwise entered by a different widget
>>> than simple forward/reverse menu completion.  In that instance the user is
>>> presumably not continuing with the menu in progress but instead wants to
>>> start over.  I.e. similar to tests of $LASTWIDGET in Functions/Zle/*.
>>> } anyone foresee any problem with just relaxing the condition (see patch).
>>> Maybe we'd need another flag action for "zle -f" to continue/interrupt a
>>> menu in progress, but probably it will work as expected more often with
>>> the patch than without.  I suggest you push and we'll find out if a need
>>> for a flag arises.
>> I can tell you I quite often complete a directory name using normal
>> completion, and then press ctrl-n to complete files inside by latest
>> modification date. If this continued cycling directories instead, it
>> would be quite inconvenient. But yeah, push and we'll see what happens
>> to that.
> Well, this use-case did indeed break with this commit.

While I'm sure everyone would be happy to reimplement this keybind
based on my vague description, here is the relevant setup:

zstyle ':completion:most-recent-file:*' match-original both
zstyle ':completion:most-recent-file:*' file-sort modification
zstyle ':completion:most-recent-file:*' file-patterns '*:all\ files'
zstyle ':completion:most-recent-file:*' hidden all
zstyle ':completion:most-recent-file:*' completer _files
zle -C most-recent-file menu-complete _generic

bindkey "^N"      most-recent-file

I would like ^N after TAB to start completion over (even if this was
originally a ^N completion), but TAB after ^N to continue the same
completion. This is how it worked before the commit. I'm fine with
replacing _generic with something else either custom in my rc or if we
distribute a new helper function.

Mikael Magnusson

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