Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RFC: region_highlight inter-plugin interoperability: echo service?
z-sy-h would like to have a way to know which region_highlight entries
it had added, so it can remove only those. This will help interoperability
with other plugins [1,2].
It won't suffice for the plugin to remember the values it added: if
z-sy-h adds "0 42 fg=foo" and then a self-insert occurs, the value
observed when z-sy-h next runs might be "1 43 fg=foo".
Eric, Oliver, and I discussed this on [PR57]. We considered several
options:
- Extend the region_highlight element syntax with some sort of value
that will be echoed back when the array is next accessed. For
example, if a plugin sets "0 42 fg=foo memo=bar", then the next time
the array is read there will be an element with "memo=bar" (unless
some other plugin intervened and removed that element in the
meantime).
The pull request as it stands calls this feature "owner=", but
consensus on the pull request was to rename it "memo=".
This has one known issue [3]: the syntax "0 42 fg=foo memo=bar" will
be parsed by existing zsh as the attribute «fg» with the value «foo
memo=bar» unless a comma is added after "foo". With that comma, both
current zsh and zsh with the patch applied parse that value the same
way (current zsh will ignore the memo, of course, but honour the fg
attribute).
- Extend the region_highlight element syntax with some sort of
"expire_upon=before-next-redraw" feature, implemented by zle itself.
Consensus on the PR was to punt on this as it can continue to be
implemented in script code. Furthermore, there are plugins (such as
Oliver's vi-exchange) that don't want their highlights to expire
automatically, but would still benefit from adding a memo=* feature.
- A proposal to encapsulate region_highlight with a builtin command that
provides CRUD semantics and an opportunity for running C code during
CRUD operations was raised, but consensus on the PR was that the
existing interface is preferable and that no compelling use-case for
running C code was identified.
Thus, we propose to add a memo=* feature to region_highlight, as
outlined in the first bullet above, based on the patch that is PR57.
Comments, please?
Cheers,
Daniel
P.S. We've discussed this for a long time across multiple tickets and
projects, so apologies on my behalf if I've omitted some context. If
so, just ask.
[1] https://github.com/zsh-users/zsh-syntax-highlighting/issues/418
[2] https://github.com/zsh-users/zsh-syntax-highlighting/issues/579
[PR57] https://github.com/zsh-users/zsh/pull/57
[3] https://github.com/zsh-users/zsh/pull/57#discussion_r419548695
Messages sorted by:
Reverse Date,
Date,
Thread,
Author