zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Bug? ignorebraces and autoloaded functions
Date: Tue, 12 Sep 2023 21:24:35 -0700	[thread overview]
Message-ID: <CAH+w=7Z-giLD4m8uaO6BpYRnOV+AB8XP3nLjc8zW9YVCAcsP5g@mail.gmail.com> (raw)

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


                 reply	other threads:[~2023-09-13  4:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7Z-giLD4m8uaO6BpYRnOV+AB8XP3nLjc8zW9YVCAcsP5g@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --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).