help / color / mirror / code / Atom feed
* Bug? ignorebraces and autoloaded functions
@ 2023-09-13  4:24 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2023-09-13  4:24 UTC (permalink / raw)
  To: Zsh hackers list

On Tue, Sep 12, 2023 at 8:41 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
> You have to setopt ignorebraces before you define the
> function.  Otherwise the internals of the function have already been
> parsed and the behavior doesn't change.

This means that a bunch of functions in the default zsh $fpath will
not load if ignorebraces is set.  As an example, try

autoload -Uz zed
setopt ignorebraces

Adding noignorebraces to the local options in the function isn't soon enough.

In the case of zed, there are two brace-enclosed
current-shell-commands on line 147.  To make it impervious to
ignorebraces, it's necessary to precede each closing brace with a
command terminator (semicolon or newline).

There are not many of these under Functions/ (and it appears the
majority of them are functions that I contributed) but there are quite
a few under Completion/.

Is this something that autoload should take care of?  Could it be
imposed by the -z option, or less intuitively the -U option, or would
a new option be needed?  A workaround is to use emulate:

emulate zsh -f -c 'autoload -U zed'

That's a bit clumsy, though.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-13  4:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13  4:24 Bug? ignorebraces and autoloaded functions Bart Schaefer

Code repositories for project(s) associated with this public inbox


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).