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

Re: Global aliases, eval, and completion (Re: Expanding interactively aliases)



On Feb 27, 11:11am, Sven Wischnowsky wrote:
} Subject: Re: Global aliases, eval, and completion (Re: Expanding interacti
}
} Hmhm. Haven't looked through the completion functions yet, but below
} is a patch to replace the (internal) `noaliases' with an option `ALIAS'.
} Should I commit that?

I'd have left the internal `noaliases' as it was, and then tested the
option in these two places:

} @@ -1556,8 +1551,8 @@
}  
}  	if (tok == STRING) {
}  	    /* Check for an alias */
} -	    an = noaliases ? NULL :
} -		(Alias) aliastab->getnode(aliastab, yytext);
} +	    an = opts[ALIASOPT] ?
} +		(Alias) aliastab->getnode(aliastab, yytext) : NULL;
}  	    if (an && !an->inuse && ((an->flags & ALIAS_GLOBAL) || incmdpos ||
}  				     inalmore)) {
}  		inpush(an->text, INP_ALIAS, an);

} @@ -976,7 +977,7 @@
}  
}      /* This global flag is used to signal the lexer code if it should *
}       * expand aliases or not.                                         */
} -    noaliases = isset(COMPLETEALIASES);
} +    opts[ALIASOPT] = !isset(COMPLETEALIASES);
}  
}      /* Find out if we are somewhere in a `string', i.e. inside '...', *
}       * "...", `...`, or ((...)). Nowadays this is only used to find   *

There's no reason to flip the sense of the option when the code internally
wants to disable aliases, nor as far as I can tell any reason to allow the
option to be enabled by user code when the internals have disabled it.

} Should it (in options.c) use (OPT_ALL & ~OPT_SH) instead of OPT_ALL?

Turning off aliases when emulating sh sounds like the right thing to me.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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