zsh-users
 help / color / mirror / code / Atom feed
* Trying to learn ... RCS and GLOBAL_RCS
@ 2022-03-26 13:53 Perry Smith
  2022-03-26 16:39 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Perry Smith @ 2022-03-26 13:53 UTC (permalink / raw)
  To: zsh-users

I won’t paste the whole text here but I’m looking at the STARTUP/SHUTDOWN FILES section in zsh(1) / zshall(1) and the documentation isn’t matching what I’m seeing.  Do I need more coffee???

The man page says:

> "Both RCS and GLOBAL_RCS are set by default.”.  

Yet when I do “unsetopt” at the very top of my /etc/zshenv file, it says:

> noglobalrcs
> norcs

But I know all of my RC files and global RC files are being read — via a “trace” function I cobbled together.

I started using ZSH when Apple switched to it and I tried to read and study and learn.  This past week, I was trying to use a BSD system and my history wasn’t being saved.  Turns out Apple hid  setting of the various history zsh variables that in their /etc/zshrc and /etc/zshrc_Apple_Terminal so I never added it to my start up files.  That caused me to start digging more to fully understand things and that’s when I came up with these questions.

It is the same with logout.  On Apple (and I assume on BSD once I get the other options and variables set properly), history is being saved yet the man page says:

> "Note also that the RCS option affects the saving of history files, i.e. if RCS is unset when the shell exits, no history file will be saved.”

These are the 5.8 and 5.8.1 man pages.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Trying to learn ... RCS and GLOBAL_RCS
  2022-03-26 13:53 Trying to learn ... RCS and GLOBAL_RCS Perry Smith
@ 2022-03-26 16:39 ` Bart Schaefer
  2022-03-26 16:44   ` Perry Smith
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2022-03-26 16:39 UTC (permalink / raw)
  To: Perry Smith; +Cc: Zsh Users

On Sat, Mar 26, 2022 at 6:53 AM Perry Smith <pedz@easesoftware.com> wrote:
>
> Yet when I do “unsetopt” at the very top of my /etc/zshenv file, it says:
>
> > noglobalrcs
> > norcs

Double negative.  "unsetopt" shows the options that are not set, so
"not no globalrcs" == "globalrcs".  In another bit of oddness that's
probably gone unnoticed for 30 years, "setopt" shows you the options
that are not the same as the defaults, and "unsetopt" shows you the
options that are the same as the defaults.  (Unless the kshoptionprint
option is set, in which case both show you everything.)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Trying to learn ... RCS and GLOBAL_RCS
  2022-03-26 16:39 ` Bart Schaefer
@ 2022-03-26 16:44   ` Perry Smith
  2022-03-26 16:48     ` Bart Schaefer
  2022-03-26 17:05     ` Bart Schaefer
  0 siblings, 2 replies; 8+ messages in thread
From: Perry Smith @ 2022-03-26 16:44 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users



> On Mar 26, 2022, at 11:39, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
> On Sat, Mar 26, 2022 at 6:53 AM Perry Smith <pedz@easesoftware.com> wrote:
>> 
>> Yet when I do “unsetopt” at the very top of my /etc/zshenv file, it says:
>> 
>>> noglobalrcs
>>> norcs
> 
> Double negative.  "unsetopt" shows the options that are not set, so
> "not no globalrcs" == "globalrcs".  In another bit of oddness that's
> probably gone unnoticed for 30 years, "setopt" shows you the options
> that are not the same as the defaults, and "unsetopt" shows you the
> options that are the same as the defaults.  (Unless the kshoptionprint
> option is set, in which case both show you everything.)

Oh dear…  That is definitely where my confusing is coming from.

Can I get the current state of all options (regardless of matching the 
default or not)?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Trying to learn ... RCS and GLOBAL_RCS
  2022-03-26 16:44   ` Perry Smith
@ 2022-03-26 16:48     ` Bart Schaefer
  2022-03-26 17:04       ` Perry Smith
  2022-03-26 17:05     ` Bart Schaefer
  1 sibling, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2022-03-26 16:48 UTC (permalink / raw)
  To: Perry Smith; +Cc: Zsh Users

On Sat, Mar 26, 2022 at 9:45 AM Perry Smith <pedz@easesoftware.com> wrote:
>
> Can I get the current state of all options (regardless of matching the
> default or not)?

Your best choice is probably:
  set -o


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Trying to learn ... RCS and GLOBAL_RCS
  2022-03-26 16:48     ` Bart Schaefer
@ 2022-03-26 17:04       ` Perry Smith
  2022-03-26 17:39         ` Mikael Magnusson
  0 siblings, 1 reply; 8+ messages in thread
From: Perry Smith @ 2022-03-26 17:04 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users



> On Mar 26, 2022, at 11:48, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
> On Sat, Mar 26, 2022 at 9:45 AM Perry Smith <pedz@easesoftware.com> wrote:
>> 
>> Can I get the current state of all options (regardless of matching the
>> default or not)?
> 
> Your best choice is probably:
>  set -o

Yea.  That’s better.  I was working on:

( setopt | sed -e 's/$/ on/' -e 's/^no\(.*\) on$/\1 off/' ; unsetopt | sed -e 's/$/ off/' -e 's/^no\(.*\) off$/\1 on/' ) | sort

Since each option is either set to default or not.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Trying to learn ... RCS and GLOBAL_RCS
  2022-03-26 16:44   ` Perry Smith
  2022-03-26 16:48     ` Bart Schaefer
@ 2022-03-26 17:05     ` Bart Schaefer
  2022-03-26 17:18       ` Perry Smith
  1 sibling, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2022-03-26 17:05 UTC (permalink / raw)
  To: Perry Smith; +Cc: Zsh Users

On Sat, Mar 26, 2022 at 9:45 AM Perry Smith <pedz@easesoftware.com> wrote:
>
> > On Mar 26, 2022, at 11:39, Bart Schaefer <schaefer@brasslantern.com> wrote:
> >
> > Double negative.  "unsetopt" shows the options that are not set, so
> > "not no globalrcs" == "globalrcs".
>
> Oh dear…  That is definitely where my confusing is coming from.

History lesson time ...

The zsh option naming convention was originally taken from csh.  The
most obvious example is the csh "nomatch" default that causes "echo
foo*bar" to print "No match" when the globbing comparison fails.  To
turn off the "nomatch" behavior, you reversed it as "set nonomatch".
This is because csh didn't have options with "off" state, it only had
the default behavior and options that when set, changed the default
behavior.

Consequently a bunch of zsh options got named "nosomething" and to
turn them off you would use "setopt nonosomething".

At some point in the mid-90s it was the list consensus that
documenting the options under their "nosomething" names was confusing,
so the docs all got rewritten to use the "affirmative" names.  The
output of "setopt" and "unsetopt", however, continues using the "no"
prefix based on the historic practice.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Trying to learn ... RCS and GLOBAL_RCS
  2022-03-26 17:05     ` Bart Schaefer
@ 2022-03-26 17:18       ` Perry Smith
  0 siblings, 0 replies; 8+ messages in thread
From: Perry Smith @ 2022-03-26 17:18 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users


> On Mar 26, 2022, at 12:05, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
> History lesson time ...
> 

Thank you.

set -o gives things like 

noglob                off

The silly sed thing I sent gives:

glob on

I started with csh back in 1984.  Moved to bash when it first appeared.  And then moved to zsh about four years ago.

My favorite double negative… The X server code (when I looked at it years ago) was laced with:

#ifndef NOT_MOTIF




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Trying to learn ... RCS and GLOBAL_RCS
  2022-03-26 17:04       ` Perry Smith
@ 2022-03-26 17:39         ` Mikael Magnusson
  0 siblings, 0 replies; 8+ messages in thread
From: Mikael Magnusson @ 2022-03-26 17:39 UTC (permalink / raw)
  To: Perry Smith; +Cc: Bart Schaefer, Zsh Users

On 3/26/22, Perry Smith <pedz@easesoftware.com> wrote:
>
>
>> On Mar 26, 2022, at 11:48, Bart Schaefer <schaefer@brasslantern.com>
>> wrote:
>>
>> On Sat, Mar 26, 2022 at 9:45 AM Perry Smith <pedz@easesoftware.com>
>> wrote:
>>>
>>> Can I get the current state of all options (regardless of matching the
>>> default or not)?
>>
>> Your best choice is probably:
>>  set -o
>
> Yea.  That’s better.  I was working on:
>
> ( setopt | sed -e 's/$/ on/' -e 's/^no\(.*\) on$/\1 off/' ; unsetopt | sed
> -e 's/$/ off/' -e 's/^no\(.*\) off$/\1 on/' ) | sort
>
> Since each option is either set to default or not.

A good old trick is:
printf '%s := %s\n' "${(@kv)options}"

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-26 17:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-26 13:53 Trying to learn ... RCS and GLOBAL_RCS Perry Smith
2022-03-26 16:39 ` Bart Schaefer
2022-03-26 16:44   ` Perry Smith
2022-03-26 16:48     ` Bart Schaefer
2022-03-26 17:04       ` Perry Smith
2022-03-26 17:39         ` Mikael Magnusson
2022-03-26 17:05     ` Bart Schaefer
2022-03-26 17:18       ` Perry Smith

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