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

PATCH: compadd -r without -S

Does anybody (= Sven) see anything wrong with the following?  It allows
you to use the -r and -R options to compadd to delete an automatically
added space.  For example,

_foo() { _files -r '@#' }

removes the space automatically added if the next character typed is @
or #, which will help with the Perforce completion I am writing.  It
also overrides the removal of the space when you type `|' etc., so I
should probably write

_foo() { _files -r '@#\- \t\n;&|' }

to get the usual behaviour with other characters.

(I'm don't think this helps David Harris, since there's still no way of
overriding the default set of things to remove for general completions.)

This is not the same as

_foo() { _files -S ' ' -r '@#\- \t\n;&|' }

which would show the space when I don't want it, such as in menu

As far as I can see, this doesn't have any effect on existing valid uses
of -r or -R.

Index: Src/Zle/compresult.c
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.46
diff -u -r1.46 compresult.c
--- Src/Zle/compresult.c	30 Jul 2002 07:47:05 -0000	1.46
+++ Src/Zle/compresult.c	6 Jan 2003 19:09:56 -0000
@@ -1114,7 +1114,7 @@
 	    inststrlen(" ", 1, 1);
 	    if (minfo.we)
-		makesuffix(1);
+		makesuffixstr(m->remf, m->rems, 1);
     if (minfo.we && partest && isset(AUTOPARAMKEYS))
Index: Doc/Zsh/compwid.yo
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compwid.yo,v
retrieving revision 1.34
diff -u -r1.34 compwid.yo
--- Doc/Zsh/compwid.yo	1 Jul 2002 08:25:17 -0000	1.34
+++ Doc/Zsh/compwid.yo	6 Jan 2003 19:09:56 -0000
@@ -575,6 +575,10 @@
 backslash sequence is understood in this string: `tt(\-)' stands for
 all characters that insert nothing. Thus `tt(-S "=" -q)' is the same
 as `tt(-S "=" -r "= \t\n\-")'.
+This option may also be used without the tt(-S) option; then any
+automatically added space will be removed when one of the characters in the
+list is typed.
 item(tt(-R) var(remove-func))(
 This is another form of the tt(-r) option. When a suffix 

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 
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