Zsh Mailing List Archive
Messages sorted by:
Re: Overriding a yank* widget in zle
- X-seq: zsh-workers 28560
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Overriding a yank* widget in zle
- Date: Fri, 31 Dec 2010 00:28:20 -0800
- In-reply-to: <AANLkTikgELYV5WuDOD9XEPRX7mUiGhtObx6Q5v=DzB2S@xxxxxxxxxxxxxx>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <AANLkTikgELYV5WuDOD9XEPRX7mUiGhtObx6Q5v=DzB2S@xxxxxxxxxxxxxx>
On Dec 30, 1:59pm, Wayne Davison wrote:
} I've coded up a patch that adds the -y option to zle so that I can define a
} "zle -Ny yank" widget (as well as yank-pop), which marks it as being a
} ZLE_YANK equivalent.
This sort of follows from "zle -C". For completion widgets, it was
recognized that there are a set of behaviors which are the model for
any newly-added widget, and the builtin completion widgets provide
names for those behaviors.
Perhaps a general solution would be that for *any* widget, not just
a completion one, it should be possible to name a "prototype" widget
whose behavior the new widget is intended to simulate or replace.
"zle -P WIDGET PROTOTYPE-WIDGET [FUNCTION]" where "zle -N ..." becomes
a special case equivalent to "zle -P WIDGET self-insert FUNCTION",
or something to that effect (or maybe undefined-key instead).
Then one could write, e.g.,
zle -P history-search-sideways history-incremental-search-forward
and zle would "know" to invoke the minibuffer and re-call the function
as each new keystroke is typed, without that needing to be coded as a
loop in the widget itself.
Then the question would be whether we still need "zle -C ..." other
than for backward compatibility.
The only other solution to this that I've thought of would be to follow
the example of the auto-suffix-remove and auto-suffix-retain widgets,
that is, have a special widget whose only effect is to have the side-
effect of enabling yank-pop on the next interaction: yank-pop-enable
perhaps (is yank-pop-disable ever needed?).
Messages sorted by: