From: Bart Schaefer <schaefer@brasslantern.com>
To: Glyph <glyph@twistedmatrix.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: bug report: INTERACTIVECOMMENTS option interacts oddly with shell functions in an interactive context
Date: Mon, 30 Aug 2021 14:35:56 -0700 [thread overview]
Message-ID: <CAH+w=7YptHhCC5__MK4LqGMYS1UEoU92jWheG+mp-UXRenVZgw@mail.gmail.com> (raw)
In-Reply-To: <391FB007-1453-44CF-A990-280C59750F65@twistedmatrix.com>
On Sun, Aug 29, 2021 at 1:58 PM Glyph <glyph@twistedmatrix.com> wrote:
>
> Comments in sample_function are interpreted normally, but comments *inside* the "bogus" expression will be interpreted as executing in an interactive context
Hm, well, this is quite obviously intentional based on the code that
interprets $(...) expressions. The only way I can think of to change
it without breaking the behavior of $(...) typed at the actual command
line, would be for "source" and related operations to put
INTERACTIVECOMMENTS into the "sticky" emulation context during parsing
of the file (even if it was off in the parent shell).
That is, if "source" et al. always behaved as if
emulate $(emulate) -o interactivecomments -c 'source ...'
then comments in $(...) and related contexts would be ignored as if
they were parsed during the "source" command instead of during the
execution of the substitution.
But that could have some pretty confusing side-effects for functions
that want to examine $options (for example).
Incidentally, you almost certainly want
setopt LOCALOPTIONS INTERACTIVECOMMENTS
in any functions where you intend to put comments inside $(...),
otherwise you will propagate INTERACTIVECOMMENTS into the parent
shell.
next prev parent reply other threads:[~2021-08-30 21:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-29 20:55 Glyph
2021-08-30 21:35 ` Bart Schaefer [this message]
2021-08-31 6:03 ` Stephane Chazelas
2021-09-01 3:41 ` Bart Schaefer
2021-09-01 7:55 ` Stephane Chazelas
2021-09-01 15:17 ` Peter Stephenson
2021-09-01 17:55 ` Bart Schaefer
2021-09-01 18:09 ` Bart Schaefer
2021-09-01 18:23 ` Stephane Chazelas
2021-09-01 18:41 ` Stephane Chazelas
2021-09-01 18:43 ` Bart Schaefer
2021-09-02 9:04 ` Peter Stephenson
2021-09-09 3:50 ` Bart Schaefer
2021-09-09 19:06 ` Peter Stephenson
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=7YptHhCC5__MK4LqGMYS1UEoU92jWheG+mp-UXRenVZgw@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=glyph@twistedmatrix.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).