zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: [BUG] multibyte never set according to setopt/unsetopt output
Date: Sat, 20 Jan 2024 14:27:13 -0800	[thread overview]
Message-ID: <CAH+w=7ZzWesAf_Jg2KVgYEJAeWRFBm-h7D8MWj9saOaBt8n4FQ@mail.gmail.com> (raw)
In-Reply-To: <CAA=-s3yXDgcK-hv434Xj9M+NA8e1PVikK6tRpqPPNj+COgF8dg@mail.gmail.com>

On Fri, Jan 19, 2024 at 7:02 AM Mark J. Reed <markjreed@gmail.com> wrote:
>
> Basically, because `multibyte` is on by default, the *`setopt` commands behave as if there were instead an option with the inverted meaning named `nomultibyte`, and it is that string rather than `multibyte` which shows up

History lesson time for the interested (and who haven't been here all along) ...

Originally most of zsh's options (dozens have been added since) were
based on BSD csh options.  In csh, the defaults were always on, and if
you wanted something to not happen, you had to assert a negative.
Hence for example issuing a "no match" error on a failed glob is
default behavior, and to disable that you assert "nonomatch".
Consequently zsh had "setopt nonomatch" and a number of other options
with a "no" prefix that meant to turn some behavior off.  This led to
a lot of double-negatives when trying to toggle an option via the
"unsetopt" command.

Zsh's first innovation to try to account for this was to start looking
for that leading "no" and reversing the meaning for setopt/unsetopt
based on its presence or absence -- but internally the options were
still named, and therefore documented, in the original forms.

Later (but before the code moved into CVS and thence git, so AFAIK
it's not findable in the commit logs) there was an effort made to
force as many options as possible to be coded and documented in the
"positive" sense, to remove the double negatives internally and make
it possible to do so in scripts -- but the operation of the setopt and
unsetopt commands with respect to a leading "no" was kept unchanged
for backward compatibility, and their respective output still follows
that convention.

Consequently most of the time when a function is asserting a
particular option state, you'll see a single "setopt localoptions"
followed by a mix of options with or without a "no" prefix, because
that's more concise than writing setopt to turn things on and
following that with unsetopt to turn other things off, even though the
option names are now arranged so as to permit exactly that.


  reply	other threads:[~2024-01-20 22:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 16:04 Mark J. Reed
2023-12-20 16:22 ` Peter Stephenson
2023-12-20 16:44   ` Bart Schaefer
2023-12-20 16:54     ` Mikael Magnusson
2023-12-20 16:55     ` Peter Stephenson
2023-12-20 17:06       ` Mikael Magnusson
2023-12-20 17:30         ` Peter Stephenson
2023-12-20 17:40           ` Mikael Magnusson
2024-01-19 15:02             ` Mark J. Reed
2024-01-20 22:27               ` Bart Schaefer [this message]
2023-12-20 16:59   ` Mikael Magnusson

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=7ZzWesAf_Jg2KVgYEJAeWRFBm-h7D8MWj9saOaBt8n4FQ@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).