From: Bart Schaefer <schaefer@brasslantern.com>
To: Zach Riggle <zachriggle@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Function names prefixed with "%"
Date: Thu, 26 May 2022 20:49:33 -0700 [thread overview]
Message-ID: <CAH+w=7YaDarRbA5BuSyrNfoKmnXDkOVTi8_eLx+HmPtQX_uHrg@mail.gmail.com> (raw)
In-Reply-To: <CAMP9c5=UwP7xG6xbAGZKMX-angbhc_iaJoDT=BOwn3PXK-QKkA@mail.gmail.com>
On Thu, May 26, 2022 at 6:15 PM Zach Riggle <zachriggle@gmail.com> wrote:
>
> It seems that it's completely valid to declare a function with a leading percent, but it's not able to be called due to be interpreted as job control.
The very first entry in Etc/BUGS says:
The pattern %?* matches names beginning with %? instead of names with at
least two characters beginning with %. This is a hack to allow %?foo job
substitution without quoting. This behaviour is incompatible with sh
and ksh and may be removed in the future.
You've noticed a corollary that command names can't be matched for the
same reason.
> Is there any way around this behavior? I've found that this can be worked around with aliases...
You can check in an accept-line wrapper widget or in a zle-line-finish
hook for whether there actually is a job matching the pattern and
insert the necessary leading backslash if there is not. Or if you
never use that job lookup syntax, you can just always edit every word
that begins with % to instead use \% via one of those functions.
next prev parent reply other threads:[~2022-05-27 3:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 1:14 Zach Riggle
2022-05-27 1:36 ` Mikael Magnusson
2022-05-27 1:57 ` Zach Riggle
2022-05-27 2:40 ` Lawrence Velázquez
2022-05-27 3:49 ` Bart Schaefer [this message]
2022-05-27 11:08 ` Mikael Magnusson
2022-05-27 17:09 ` 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=7YaDarRbA5BuSyrNfoKmnXDkOVTi8_eLx+HmPtQX_uHrg@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zachriggle@gmail.com \
--cc=zsh-users@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).