zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: gsslist+zshdev@anthropohedron.net, zsh-workers@zsh.org
Subject: Re: PATCH: custom zsh hooks (was Re: Extending zsh hooks)
Date: Wed, 8 Nov 2023 21:13:19 -0800	[thread overview]
Message-ID: <CAH+w=7YhV-vsh=ye=xSjrr2JR1n0rZECsrBZSrmAgtFD3Q32mQ@mail.gmail.com> (raw)
In-Reply-To: <ZUveju0JwMTPa1cM@peterbilt.lan>

On Wed, Nov 8, 2023 at 11:17 AM Gregory Seidman
<gsslist+zshdev@anthropohedron.net> wrote:
>
> My one-line-plus-documentation patch is below. The proposal is to
> have a way to add custom hook types to be managed with add-zsh-hook.

The doc paragraph preceding the one you edited says:
  Several functions ... are automatically called at specific points during
  shell execution.

This patch would introduce a new reserved parameter name; the arrays
thereby managed are obviously not related to any other
automatically-called function; and extending the list of hook names in
this way introduces the possibility of name conflicts with actual new
hook functions that might be added in the future.

I think we need some more justification for why this should be
enshrined in the official sources, and for why it should overload
add-zsh-hook rather than be its own new function.  The options-parsing
part of add-zsh-hook is already duplicated in add-zle-hook-widget, so
either there's no issue with duplicating it again, or it's a candidate
for being pulled out into its own function and then called from both
of those and a third new one (or just rewritten using zparseopts,
since getopts/OPTIND handling is a bit iffy [cf. README for changes
5.8.1 to 5.9]).

If a new function is introduced, I would suggest basing it on
add-zle-hook-widget rather than on add-zsh-hook, because
add-zle-hook-widget uses zstyle rather than array parameters and
thereby doesn't clutter the parameter namespace.  (That assumes you
want something mostly backward compatible, because going forward this
could all use namespaces.)


  reply	other threads:[~2023-11-09  5:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07 23:31 Extending zsh hooks Gregory Seidman
2023-11-08  2:35 ` Lawrence Velázquez
2023-11-08 19:16   ` PATCH: custom zsh hooks (was Re: Extending zsh hooks) Gregory Seidman
2023-11-09  5:13     ` Bart Schaefer [this message]
2023-11-09  4:09   ` Extending zsh hooks Bart Schaefer

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='CAH+w=7YhV-vsh=ye=xSjrr2JR1n0rZECsrBZSrmAgtFD3Q32mQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=gsslist+zshdev@anthropohedron.net \
    --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).