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

PATCH: emulate (Re: Prompt fun)



Bart Schaefer wrote:
>   emulate -L zsh
>+  setopt extendedglob

This shouldn't be causing confusion.  emulate is supposed to set all
(and only) the options that can affect the behaviour of a script.
The patch below fixes this.

The patch quoted above is still necessary; EXTENDED_GLOB is unset
by default even in zsh mode.  Would changing that break any scripts?
I suspect that it wouldn't, and would be a good idea.

-zefram

--- Src/options.c~	Thu Oct  7 11:11:26 1999
+++ Src/options.c	Thu Oct  7 11:35:11 1999
@@ -69,11 +69,11 @@
  * to avoid formatting problems.
  */
 static struct optname optns[] = {
-{NULL, "allexport",	      0,			 ALLEXPORT},
+{NULL, "allexport",	      OPT_EMULATE,		 ALLEXPORT},
 {NULL, "alwayslastprompt",    OPT_ALL,			 ALWAYSLASTPROMPT},
 {NULL, "alwaystoend",	      0,			 ALWAYSTOEND},
 {NULL, "appendhistory",	      OPT_ALL,			 APPENDHISTORY},
-{NULL, "autocd",	      0,			 AUTOCD},
+{NULL, "autocd",	      OPT_EMULATE,		 AUTOCD},
 {NULL, "autolist",	      OPT_ALL,			 AUTOLIST},
 {NULL, "automenu",	      OPT_ALL,			 AUTOMENU},
 {NULL, "autonamedirs",	      0,			 AUTONAMEDIRS},
@@ -83,17 +83,17 @@
 {NULL, "autoremoveslash",     OPT_ALL,			 AUTOREMOVESLASH},
 {NULL, "autoresume",	      0,			 AUTORESUME},
 {NULL, "badpattern",	      OPT_EMULATE|OPT_NONBOURNE, BADPATTERN},
-{NULL, "banghist",	      OPT_EMULATE|OPT_NONBOURNE, BANGHIST},
+{NULL, "banghist",	      OPT_NONBOURNE,		 BANGHIST},
 {NULL, "bareglobqual",        OPT_EMULATE|OPT_ZSH,       BAREGLOBQUAL},
 {NULL, "bashautolist",	      0,                         BASHAUTOLIST},
 {NULL, "beep",		      OPT_ALL,			 BEEP},
 {NULL, "bgnice",	      OPT_EMULATE|OPT_NONBOURNE, BGNICE},
-{NULL, "braceccl",	      0,			 BRACECCL},
+{NULL, "braceccl",	      OPT_EMULATE,		 BRACECCL},
 {NULL, "bsdecho",	      OPT_EMULATE|OPT_SH,	 BSDECHO},
-{NULL, "cdablevars",	      0,			 CDABLEVARS},
-{NULL, "chasedots",	      0,			 CHASEDOTS},
-{NULL, "chaselinks",	      0,			 CHASELINKS},
-{NULL, "clobber",	      OPT_ALL,			 CLOBBER},
+{NULL, "cdablevars",	      OPT_EMULATE,		 CDABLEVARS},
+{NULL, "chasedots",	      OPT_EMULATE,		 CHASEDOTS},
+{NULL, "chaselinks",	      OPT_EMULATE,		 CHASELINKS},
+{NULL, "clobber",	      OPT_EMULATE|OPT_ALL,	 CLOBBER},
 {NULL, "completealiases",     0,			 COMPLETEALIASES},
 {NULL, "completeinword",      0,			 COMPLETEINWORD},
 {NULL, "correct",	      0,			 CORRECT},
@@ -103,17 +103,17 @@
 {NULL, "cshjunkiequotes",     OPT_EMULATE|OPT_CSH,	 CSHJUNKIEQUOTES},
 {NULL, "cshnullglob",	      OPT_EMULATE|OPT_CSH,	 CSHNULLGLOB},
 {NULL, "equals",	      OPT_EMULATE|OPT_ZSH,	 EQUALS},
-{NULL, "errexit",	      0,			 ERREXIT},
-{NULL, "exec",		      OPT_ALL,			 EXECOPT},
-{NULL, "extendedglob",	      0,			 EXTENDEDGLOB},
-{NULL, "extendedhistory",     OPT_EMULATE|OPT_CSH,	 EXTENDEDHISTORY},
+{NULL, "errexit",	      OPT_EMULATE,		 ERREXIT},
+{NULL, "exec",		      OPT_EMULATE|OPT_ALL,		 EXECOPT},
+{NULL, "extendedglob",	      OPT_EMULATE,		 EXTENDEDGLOB},
+{NULL, "extendedhistory",     OPT_CSH,			 EXTENDEDHISTORY},
 {NULL, "flowcontrol",	      OPT_ALL,			 FLOWCONTROL},
 {NULL, "functionargzero",     OPT_EMULATE|OPT_NONBOURNE, FUNCTIONARGZERO},
-{NULL, "glob",		      OPT_ALL,			 GLOBOPT},
+{NULL, "glob",		      OPT_EMULATE|OPT_ALL,	 GLOBOPT},
 {NULL, "globalrcs",           OPT_ALL,			 GLOBALRCS},
 {NULL, "globassign",	      OPT_EMULATE|OPT_CSH,	 GLOBASSIGN},
 {NULL, "globcomplete",	      0,			 GLOBCOMPLETE},
-{NULL, "globdots",	      0,			 GLOBDOTS},
+{NULL, "globdots",	      OPT_EMULATE,		 GLOBDOTS},
 {NULL, "globsubst",	      OPT_EMULATE|OPT_NONZSH,	 GLOBSUBST},
 {NULL, "hashcmds",	      OPT_ALL,			 HASHCMDS},
 {NULL, "hashdirs",	      OPT_ALL,			 HASHDIRS},
@@ -135,7 +135,7 @@
 {NULL, "ignoreeof",	      0,			 IGNOREEOF},
 {NULL, "incappendhistory",    0,			 INCAPPENDHISTORY},
 {NULL, "interactive",	      OPT_SPECIAL,		 INTERACTIVE},
-{NULL, "interactivecomments", OPT_EMULATE|OPT_BOURNE,	 INTERACTIVECOMMENTS},
+{NULL, "interactivecomments", OPT_BOURNE,		 INTERACTIVECOMMENTS},
 {NULL, "ksharrays",	      OPT_EMULATE|OPT_BOURNE,	 KSHARRAYS},
 {NULL, "kshautoload",	      OPT_EMULATE|OPT_BOURNE,	 KSHAUTOLOAD},
 {NULL, "kshglob",             OPT_EMULATE|OPT_KSH,       KSHGLOB},
@@ -149,7 +149,7 @@
 {NULL, "localtraps",	      OPT_EMULATE|OPT_KSH,	 LOCALTRAPS},
 {NULL, "login",		      OPT_SPECIAL,		 LOGINSHELL},
 {NULL, "longlistjobs",	      0,			 LONGLISTJOBS},
-{NULL, "magicequalsubst",     0,			 MAGICEQUALSUBST},
+{NULL, "magicequalsubst",     OPT_EMULATE,		 MAGICEQUALSUBST},
 {NULL, "mailwarning",	      0,			 MAILWARNING},
 {NULL, "markdirs",	      0,			 MARKDIRS},
 {NULL, "menucomplete",	      0,			 MENUCOMPLETE},
@@ -158,23 +158,23 @@
 {NULL, "nomatch",	      OPT_EMULATE|OPT_NONBOURNE, NOMATCH},
 {NULL, "notify",	      OPT_ZSH,			 NOTIFY},
 {NULL, "nullglob",	      OPT_EMULATE,		 NULLGLOB},
-{NULL, "numericglobsort",     0,			 NUMERICGLOBSORT},
+{NULL, "numericglobsort",     OPT_EMULATE,		 NUMERICGLOBSORT},
 {NULL, "overstrike",	      0,			 OVERSTRIKE},
-{NULL, "pathdirs",	      0,			 PATHDIRS},
+{NULL, "pathdirs",	      OPT_EMULATE,		 PATHDIRS},
 {NULL, "posixbuiltins",	      OPT_EMULATE|OPT_BOURNE,	 POSIXBUILTINS},
 {NULL, "printeightbit",       0,                         PRINTEIGHTBIT},
 {NULL, "printexitvalue",      0,			 PRINTEXITVALUE},
 {NULL, "privileged",	      OPT_SPECIAL,		 PRIVILEGED},
-{NULL, "promptbang",	      OPT_EMULATE|OPT_KSH,	 PROMPTBANG},
+{NULL, "promptbang",	      OPT_KSH,			 PROMPTBANG},
 {NULL, "promptcr",	      OPT_ALL,			 PROMPTCR},
-{NULL, "promptpercent",	      OPT_EMULATE|OPT_NONBOURNE, PROMPTPERCENT},
-{NULL, "promptsubst",	      OPT_EMULATE|OPT_KSH,	 PROMPTSUBST},
-{NULL, "pushdignoredups",     0,			 PUSHDIGNOREDUPS},
-{NULL, "pushdminus",	      0,			 PUSHDMINUS},
+{NULL, "promptpercent",	      OPT_NONBOURNE,		 PROMPTPERCENT},
+{NULL, "promptsubst",	      OPT_KSH,			 PROMPTSUBST},
+{NULL, "pushdignoredups",     OPT_EMULATE,		 PUSHDIGNOREDUPS},
+{NULL, "pushdminus",	      OPT_EMULATE,		 PUSHDMINUS},
 {NULL, "pushdsilent",	      0,			 PUSHDSILENT},
-{NULL, "pushdtohome",	      0,			 PUSHDTOHOME},
-{NULL, "rcexpandparam",	      0,			 RCEXPANDPARAM},
-{NULL, "rcquotes",	      0,			 RCQUOTES},
+{NULL, "pushdtohome",	      OPT_EMULATE,		 PUSHDTOHOME},
+{NULL, "rcexpandparam",	      OPT_EMULATE,		 RCEXPANDPARAM},
+{NULL, "rcquotes",	      OPT_EMULATE,		 RCQUOTES},
 {NULL, "rcs",		      OPT_ALL,			 RCS},
 {NULL, "recexact",	      0,			 RECEXACT},
 {NULL, "restricted",	      OPT_SPECIAL,		 RESTRICTED},
@@ -185,7 +185,7 @@
 {NULL, "shglob",	      OPT_EMULATE|OPT_BOURNE,	 SHGLOB},
 {NULL, "shinstdin",	      OPT_SPECIAL,		 SHINSTDIN},
 {NULL, "shoptionletters",     OPT_EMULATE|OPT_BOURNE,	 SHOPTIONLETTERS},
-{NULL, "shortloops",	      OPT_ALL,			 SHORTLOOPS},
+{NULL, "shortloops",	      OPT_EMULATE|OPT_ALL,	 SHORTLOOPS},
 {NULL, "shwordsplit",	      OPT_EMULATE|OPT_BOURNE,	 SHWORDSPLIT},
 {NULL, "singlecommand",	      OPT_SPECIAL,		 SINGLECOMMAND},
 {NULL, "singlelinezle",	      OPT_KSH,			 SINGLELINEZLE},
END



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