From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zach Riggle <zachriggle@gmail.com>, Zsh Users <zsh-users@zsh.org>
Subject: Re: Function names prefixed with "%"
Date: Fri, 27 May 2022 13:08:42 +0200 [thread overview]
Message-ID: <CAHYJk3RzWJsTj5LfTm2=6mH-E02tfWaGX85xRbzKpp_rWQEOzQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YaDarRbA5BuSyrNfoKmnXDkOVTi8_eLx+HmPtQX_uHrg@mail.gmail.com>
On 5/27/22, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 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.
I think this is unrelated, the problem Zach has is that
% %foo() { echo hi }; %foo
outputs
fg: job not found: foo
While the bug is that
% echo %?foo
outputs
%?foo
instead of
zsh: no matches found: %?foo
eg, the ? in %?* is not a pattern character effectively.
You can combine these two problems but the result is quite anti-synergistic:
% %?foo() { echo hi }
% %?foo
fg: job not found: ?foo
% echo %?foo
%?foo
--
Mikael Magnusson
next prev parent reply other threads:[~2022-05-27 11:09 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
2022-05-27 11:08 ` Mikael Magnusson [this message]
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='CAHYJk3RzWJsTj5LfTm2=6mH-E02tfWaGX85xRbzKpp_rWQEOzQ@mail.gmail.com' \
--to=mikachu@gmail.com \
--cc=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).