Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bug? ignorebraces and autoloaded functions



On Tue, Sep 12, 2023 at 8:41 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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
zed

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.




Messages sorted by: Reverse Date, Date, Thread, Author