about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-02-28 09:12:54 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-02-28 09:12:54 +0000
commit061c1ce9129b3d34e8cf386633bbcc54110bd569 (patch)
treea69a2c9f23118dccb1feb6cdc75d9777e90ca3d8
parent5621ce6faf905448bf814288209c0b0104d45b14 (diff)
downloadzsh-061c1ce9129b3d34e8cf386633bbcc54110bd569.tar.gz
zsh-061c1ce9129b3d34e8cf386633bbcc54110bd569.tar.xz
zsh-061c1ce9129b3d34e8cf386633bbcc54110bd569.zip
add `aliases' option to be able to disable alias expansion (13554)
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Core/compinit1
-rw-r--r--Doc/Zsh/options.yo5
-rw-r--r--Src/Zle/compcore.c4
-rw-r--r--Src/Zle/compctl.c7
-rw-r--r--Src/Zle/zle_tricky.c9
-rw-r--r--Src/lex.c2
-rw-r--r--Src/options.c1
-rw-r--r--Src/zsh.h1
9 files changed, 27 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 90c21dac4..21e67cfa7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-02-28  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 13554: Completion/Core/compinit, Doc/Zsh/options.yo, Src/lex.c,
+ 	Src/options.c, Src/zsh.h, Src/Zle/compcore.c, Src/Zle/compctl.c,
+ 	Src/Zle/zle_tricky.c: add `aliases' option to be able to disable
+ 	alias expansion
+	
 2001-02-26  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 13536: Completion/Base/_sub_commands, Completion/Core/_normal,
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index 96779d7f7..11f0719cf 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -137,6 +137,7 @@ _comp_options=(
     NO_ksharrays
     NO_cshnullglob
     NO_allexport
+    NO_aliases
 )
 
 # These can hold names of functions that are to be called before/after all
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 676cdd6a0..4d4e3a490 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -53,6 +53,11 @@ tt(KSH_OPTION_PRINT) is set), `tt(setopt)' shows all options whose settings
 are changed from the default.
 
 startitem()
+pindex(ALIASES)
+cindex(aliases, expansion)
+item(tt(ALIASES) <D>)(
+Expand aliases.
+)
 pindex(ALL_EXPORT)
 cindex(export, automatic)
 item(tt(ALL_EXPORT) (tt(-a), ksh: tt(-a)))(
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 715e4ffc1..887557f40 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1237,7 +1237,7 @@ set_comp_sep(void)
     LinkNode n;
     int owe = we, owb = wb, ocs = cs, swb, swe, scs, soffs, ne = noerrs;
     int tl, got = 0, i = 0, cur = -1, oll = ll, sl, remq;
-    int ois = instring, oib = inbackt, noffs = lp;
+    int ois = instring, oib = inbackt, noffs = lp, ona = noaliases;
     char *tmp, *p, *ns, *ol = (char *) line, sav, *qp, *qs, *ts, qc = '\0';
 
     s += lip;
@@ -1299,7 +1299,7 @@ set_comp_sep(void)
 	}
 	i++;
     } while (tok != ENDINPUT && tok != LEXERR);
-    noaliases = 0;
+    noaliases = ona;
     strinend();
     inpop();
     errflag = zleparse = 0;
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 44bf73700..56de52e46 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -2753,7 +2753,7 @@ sep_comp_string(char *ss, char *s, int noffs)
     LinkNode n;
     int owe = we, owb = wb, ocs = cs, swb, swe, scs, soffs, ne = noerrs;
     int sl = strlen(ss), tl, got = 0, i = 0, cur = -1, oll = ll, remq;
-    int ois = instring, oib = inbackt;
+    int ois = instring, oib = inbackt, ona = noaliases;
     char *tmp, *p, *ns, *ol = (char *) line, sav, *oaq = autoq, *qp, *qs;
     char *ts, qc = '\0';
 
@@ -2813,7 +2813,7 @@ sep_comp_string(char *ss, char *s, int noffs)
 	}
 	i++;
     } while (tok != ENDINPUT && tok != LEXERR);
-    noaliases = 0;
+    noaliases = ona;
     strinend();
     inpop();
     errflag = zleparse = 0;
@@ -3648,6 +3648,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	LinkList foo = newlinklist();
 	LinkNode n;
 	int first = 1, ng = opts[NULLGLOB], oowe = we, oowb = wb;
+	int ona = noaliases;
 	char *tmpbuf;
 
 	opts[NULLGLOB] = 1;
@@ -3669,7 +3670,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 		addlinknode(foo, ztrdup(tokstr));
 	    first = 0;
 	} while (tok != ENDINPUT && tok != LEXERR);
-	noaliases = 0;
+	noaliases = ona;
 	strinend();
 	inpop();
 	errflag = zleparse = 0;
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e97bd1f6d..31556041c 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -964,6 +964,7 @@ static char *
 get_comp_string(void)
 {
     int t0, tt0, i, j, k, cp, rd, sl, ocs, ins, oins, ia, parct, varq = 0;
+    int ona = noaliases;
     char *s = NULL, *linptr, *tmp, *p, *tt = NULL;
 
     freebrinfo(brbeg);
@@ -1236,12 +1237,12 @@ get_comp_string(void)
 	    addedx = 0;
 	    goto start;
 	}
-	noaliases = 0;
+	noaliases = ona;
 	lexrestore();
 	return NULL;
     }
 
-    noaliases = 0;
+    noaliases = ona;
 
     /* Check if we are in an array subscript.  We simply assume that  *
      * we are in a subscript if we are in brackets.  Correct solution *
@@ -2138,7 +2139,7 @@ int
 doexpandhist(void)
 {
     unsigned char *ol;
-    int oll, ocs, ne = noerrs, err;
+    int oll, ocs, ne = noerrs, err, ona = noaliases;
 
     pushheap();
     metafy_line();
@@ -2165,7 +2166,7 @@ doexpandhist(void)
      * means that the expanded string is unusable.                       */
     err = errflag;
     noerrs = ne;
-    noaliases = 0;
+    noaliases = ona;
     strinend();
     inpop();
     zleparse = 0;
diff --git a/Src/lex.c b/Src/lex.c
index 9a066b915..322bb9abe 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1556,7 +1556,7 @@ exalias(void)
 
 	if (tok == STRING) {
 	    /* Check for an alias */
-	    an = noaliases ? NULL :
+	    an = (noaliases || unset(ALIASESOPT)) ? NULL :
 		(Alias) aliastab->getnode(aliastab, yytext);
 	    if (an && !an->inuse && ((an->flags & ALIAS_GLOBAL) || incmdpos ||
 				     inalmore)) {
diff --git a/Src/options.c b/Src/options.c
index 8660ade68..7223b1d59 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -69,6 +69,7 @@ mod_export HashTable optiontab;
  * to avoid formatting problems.
  */
 static struct optname optns[] = {
+{NULL, "aliases",	      OPT_EMULATE|OPT_ALL,	 ALIASESOPT},
 {NULL, "allexport",	      OPT_EMULATE,		 ALLEXPORT},
 {NULL, "alwayslastprompt",    OPT_ALL,			 ALWAYSLASTPROMPT},
 {NULL, "alwaystoend",	      0,			 ALWAYSTOEND},
diff --git a/Src/zsh.h b/Src/zsh.h
index 1d332f16c..bfc9052b6 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1305,6 +1305,7 @@ struct histent {
 
 enum {
     OPT_INVALID,
+    ALIASESOPT,
     ALLEXPORT,
     ALWAYSLASTPROMPT,
     ALWAYSTOEND,