From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19423 invoked from network); 6 Jun 2020 07:21:11 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 6 Jun 2020 07:21:11 -0000 Received: (qmail 18705 invoked by alias); 6 Jun 2020 07:21:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 46001 Received: (qmail 13870 invoked by uid 1010); 6 Jun 2020 07:21:05 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25828. spamassassin: 3.4.4. Clear:RC:0(66.111.4.28):SA:0(-2.6/5.0):. Processed in 7.248994 secs); 06 Jun 2020 07:21:05 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeggedgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggugfgfsehtke dttddtredunecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhi vghlrdhshhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeetjeeuieegtefhge eiueefvddugfdtfeegueeggfeuveekfeeiveegudeigedvtdenucffohhmrghinhepghhi thhhuhgsrdgtohhmnecukfhppeejledrudejiedrfeelrdeileenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhh rghhrghfrdhnrghmvg X-ME-Proxy: Date: Sat, 6 Jun 2020 07:20:18 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: RFC: region_highlight inter-plugin interoperability: echo service? Message-ID: <20200606072018.GA14049@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) 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