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

Re: PATCH: suffix aliases



Oliver Kiddle wrote:
> I've just been trying them out. All looks good. A couple of the whence
> outputs are not quite right by the way:
> % alias -s c=nedit
> % whence -v t.c
> c is a suffix alias fornedit  (missing space)
> % whence -c t.c
> c: suffix  aliased to nedit   (two spaces after `suffix')

Fixed below.

> I'm not particularly bothered but any thoughts on the suggestion of
> suffix aliases checking for files in a special path and not needing the
> suffix to be typed? This is closer to what 4DOS did; I'd be slightly
> inclined towards not having the current directory in that path and it
> could be useful for things like wine and java.

Hmm... it's not completely trivial, you need to trawl the entire special
path using the entire suffix alias list.  This is sounding a bit more
like a job for a handler for ENOENT or ENOEXEC on execution, perhaps.
We could run a function if a programme wasn't found and that could do
the checking.

Index: Src/hashtable.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hashtable.c,v
retrieving revision 1.14
diff -u -r1.14 hashtable.c
--- Src/hashtable.c	3 Sep 2003 10:15:36 -0000	1.14
+++ Src/hashtable.c	3 Sep 2003 12:51:39 -0000
@@ -1119,7 +1119,7 @@
 	    printf("suffix ");
 	else if (a->flags & ALIAS_GLOBAL)
 	    printf("globally ");
-	printf (" aliased to ");
+	printf ("aliased to ");
 	nicezputs(a->text, stdout);
 	putchar('\n');
 	return;
@@ -1134,7 +1134,7 @@
 	    printf(" global");
 	else
 	    printf("n");
-	printf(" alias for");
+	printf(" alias for ");
 	nicezputs(a->text, stdout);
 	putchar('\n');
 	return;

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



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