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

Re: pws-20



"Bart Schaefer" wrote:
> Peter seems to have completely forgotten to mention that a new scheme for
> /etc/z* files is in pws-20 ... but it doesn't appear to be the scheme that
> he said (in 6380) that he was going to implement.  It's "alternative #2"
> with the GLOBAL_RCS option replacing GLOBAL_RCS_FIRST.

Sorry, I was playing around looking at what to implement, and this was the
last attempt I did.  I then forgot it was still in the source when I came
back and produced pws-20, so this is a mistake.  Here's a patch against how
it appears in pws-20, putting it the way we decided; this will fail against
all previous versions.  Seems to me it's pretty hard to find the default
option settings in the manual, but I defied convention by mentioning them
here.

One subtlety I hadn't noticed:  unsetting rcs (or setting norcs) causes the
history file not to be saved.  This has always been the case, but it's
something else to think about if you start playing around with rcs in your
own initialisation files, so I noted it in the manual entry.

--- Doc/Zsh/files.yo.rcs2	Tue Jun  1 09:20:31 1999
+++ Doc/Zsh/files.yo	Tue Jun  1 09:24:21 1999
@@ -8,13 +8,12 @@
 pindex(NO_RCS, use of)
 pindex(NO_GLOBAL_RCS, use of)
 Commands are first read from tt(/etc/zshenv); this cannot be overridden.
-If the tt(RCS) option is unset, no further files are read; changing this
-option after this point has no effect on initialization files, but may
-affect behaviour on logout.  Subsequent behaviour is also modified by the
-option tt(GLOBAL_RCS).  If it is unset at any point during initialisation,
-later files in the tt(/etc) directory will not be read.  It is also
-possible for a file in tt($ZDOTDIR) to re-enable tt(GLOBAL_RCS). Both
-tt(RCS) and tt(GLOBAL_RCS) are set by default.
+Subsequent behaviour is modified by the tt(RCS) and
+tt(GLOBAL_RCS) options; the former affects all startup files, while the
+second only affects those in the tt(/etc) directory.  If one of the options
+is unset at any point, the corresponding startup file(s) will not be read.
+It is also possible for a file in tt($ZDOTDIR) to re-enable
+tt(GLOBAL_RCS). Both tt(RCS) and tt(GLOBAL_RCS) are set by default.
 
 Commands are then read from tt($ZDOTDIR/.zshenv).
 pindex(LOGIN, use of)
@@ -31,6 +30,9 @@
 end-of-file from the terminal.  However, if the shell terminates due
 to tt(exec)'ing another process, the logout files are not read.
 These are also affected by the tt(RCS) and tt(GLOBAL_RCS) options.
+Note also that the tt(RCS) option affects the saving of history files,
+i.e. if tt(RCS) is unset when the shell exits, no history file will be
+saved.
 
 If tt(ZDOTDIR) is unset, tt(HOME) is used instead.
 Those files listed above as being in tt(/etc) may be in another
--- Src/init.c.rcs2	Tue Jun  1 09:17:29 1999
+++ Src/init.c	Tue Jun  1 09:18:57 1999
@@ -758,33 +758,31 @@
 #ifdef GLOBAL_ZSHENV
 	source(GLOBAL_ZSHENV);
 #endif
-	if (isset(RCS)) {
-	    if (unset(PRIVILEGED))
-		sourcehome(".zshenv");
-	    if (islogin) {
+	if (isset(RCS) && unset(PRIVILEGED))
+	    sourcehome(".zshenv");
+	if (islogin) {
 #ifdef GLOBAL_ZPROFILE
-		if (isset(GLOBALRCS))
+	    if (isset(RCS) && isset(GLOBALRCS))
 		    source(GLOBAL_ZPROFILE);
 #endif
-		if (unset(PRIVILEGED))
-		    sourcehome(".zprofile");
-	    }
-	    if (interact) {
+	    if (isset(RCS) && unset(PRIVILEGED))
+		sourcehome(".zprofile");
+	}
+	if (interact) {
 #ifdef GLOBAL_ZSHRC
-		if (isset(GLOBALRCS))
-		    source(GLOBAL_ZSHRC);
+	    if (isset(RCS) && isset(GLOBALRCS))
+		source(GLOBAL_ZSHRC);
 #endif
-		if (unset(PRIVILEGED))
-		    sourcehome(".zshrc");
-	    }
-	    if (islogin) {
+	    if (isset(RCS) && unset(PRIVILEGED))
+		sourcehome(".zshrc");
+	}
+	if (islogin) {
 #ifdef GLOBAL_ZLOGIN
-		if (isset(GLOBALRCS))
-		    source(GLOBAL_ZLOGIN);
+	    if (isset(RCS) && isset(GLOBALRCS))
+		source(GLOBAL_ZLOGIN);
 #endif
-		if (unset(PRIVILEGED))
-		    sourcehome(".zlogin");
-	    }
+	    if (isset(RCS) && unset(PRIVILEGED))
+		sourcehome(".zlogin");
 	}
     }
     noerrexit = 0;

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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