From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: RFC: region_highlight inter-plugin interoperability: echo service?
Date: Sat, 6 Jun 2020 07:20:18 +0000 [thread overview]
Message-ID: <20200606072018.GA14049@tarpaulin.shahaf.local2> (raw)
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
next reply other threads:[~2020-06-06 7:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-06 7:20 Daniel Shahaf [this message]
2020-06-18 10:33 ` [PATCH] " Daniel Shahaf
2020-06-18 11:16 ` Daniel Shahaf
2020-06-25 12:30 ` Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200606072018.GA14049@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).