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

Re: Expanding a global alias



On Sun, 16 Sep 2007 21:14:47 +0200
"Mikael Magnusson" <mikachu@xxxxxxxxx> wrote:
> BTW it seems _expand_alias has a bug...
> I have alias -g XP='"`bs file`"' but it expands to only `bs file`, not
> "`bs file`".

That seems to have been deliberate, but I presume it was an oversight.

Index: Completion/Base/Completer/_expand_alias
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_expand_alias,v
retrieving revision 1.2
diff -u -r1.2 _expand_alias
--- Completion/Base/Completer/_expand_alias	29 May 2001 11:59:51 -0000	1.2
+++ Completion/Base/Completer/_expand_alias	17 Sep 2007 16:36:05 -0000
@@ -39,7 +39,10 @@
 [[ -z $tmp && $sel = *G* ]] && tmp=$dis_galiases[$word]
 
 if [[ -n $tmp ]]; then
-  $pre _wanted aliases expl alias compadd -UQ ${(Q)tmp%%[[:blank:]]##}
+  # We used to remove the quoting from the value in the parameter.
+  # That was probably just an oversight: an alias is always replaced
+  # literally.
+  $pre _wanted aliases expl alias compadd -UQ ${tmp%%[[:blank:]]##}
 elif (( $#pre )) && zstyle -t ":completion:${curcontext}:" complete; then
   $pre _aliases -s "$sel" -S ''
 else

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


.



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