Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH v2 (complete): Implement zle -P
- X-seq: zsh-workers 36362
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PATCH v2 (complete): Implement zle -P
- Date: Tue, 01 Sep 2015 11:50:27 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1441101029; bh=YDFCaolRlzmKIWc2mxMNMLyAiGxAUmvWPqGcO0zEPaQ=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=GsF/A0NxHRjfwFYgKe3geHveHVp1YWnX7x7+OoXC45suc6GXNhnEo1x9+TbBB2v+uUm0b0phm1l2dOs0SbOm3o8nOEfTFz15tb6QGP8RKMGdDmi52YB3ZVp6PNOBrvLTCZ2FFkfOD+wnm+D0SYJ7bbK8V1Dc05pEejspstoELasgTLgMOhaJSPfBSqjQhMCz+6H7wcpp4FD3+44d8DbcvYGyTS9Mle3+Gso4zLqNS77Y0UwwkMNPHoFHgMyqks/p3nWnaIEVcwgpQxcOjPcymTwYmnxUT7NOOeP2JBrWQVS6QNjO9YYfiO5Sfq0kgtloGZXmqumVdIc4QN6QnFmVaw==
- In-reply-to: <1441087664-9081-1-git-send-email-mikachu@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1441087664-9081-1-git-send-email-mikachu@gmail.com>
Mikael Magnusson wrote:
>
> Indeed, I'm not sure if a user can figure out which widgets are useful
> to override in this way. Would it be more useful to just do what Wayne
> did originally and let zle -N take some flags that specify which specific
> flags the new widget should have after all? The advantage of this method
> is that if we add more flags, users can wrap those widgets without us
> remembering to add a new zle -N flag as well.
I think that approach is better than the prototypes. Otherwise, users
will end up needing to dig into the source code to find arbitrary
widgets that happen to have the right combination of flags. It is a
lot easier to document a list of flags. It would also make it easier
to only offer a subset of the ZLE_ flags. Allowing a flag requires us
to do the work of fully checking the implications of making that flag
user-tweakable. It might also constrain us in the future as we preserve
backward compatibility if we don't limit those that are available.
If we do go down the route of allowing flags to be set for widgets, it
needn't be specific to user-defined widgets. I currently use the
following:
vi-cmd-suffix-retain () {
zle auto-suffix-retain
zle vi-cmd-mode
}
That might just be zle -f auto-suffix-retain vi-cmd-mode
That should not be possible for the dot variants - .vi-cmd-mode
The opposite might also be needed with +f or a no- prefix.
That could also lead to a way to make self-insert not clear the current
region by making that behaviour a flag. See 33626
As Bart mentions in 28560, the auto-suffix-retain precedent would
suggest that we should perhaps consider another yank-pop-enable widget
(or perhaps hold-yank-state given that this now affects highlighting and
not just yank-pop). An advantage of that approach over the flags is that
the full implementation of the widget is contained within the function
definition file. With the flags, we might end up needing something like
#compdef so you can put #zledef -f yank as the first line of the
function definition. Another possibility would be to try to make
something like hold-yank-state automatic - assuming that hypothetical
widget was called after every yank/yank-pop/vi-put-* in a user-defined
widget.
Either way, how can we be sure that yankb/yanke are even vaguely
sensible after the user-defined widget has finished?
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author