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

Re: cvs completion / intelligent open

On Nov 19, 12:24pm, Harshad R Joglekar wrote:
} "cvs add" should complete not only files that are not currently in cvs,
} but also files that have been locally removed (but not yet committed).

These files are included in CVS/Entries in the form


where the `-' before the version number is what marks them removed.  To
show these files for "cvs add", the pattern used to set the `omitpats'
array, in _cvs_nonentried_files() in Completion/Command/Unix/_cvs, has
to be modified to leave out lines matching the above format.

I think this should do it:

Index: Completion/Unix/Command/_cvs
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Unix/Command/_cvs,v
retrieving revision 1.7
diff -c -r1.7 _cvs
--- Completion/Unix/Command/_cvs	2001/09/05 15:22:29	1.7
+++ Completion/Unix/Command/_cvs	2001/11/19 17:21:31
@@ -959,7 +959,7 @@
   [[ -f "$realdir"CVS/Entries ]] && {
-      ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}
+      ${${${${(M)${${(f)"$(<"$realdir"CVS/Entries)"}:#/*/-*}:#(D|)/*}#(D|)/}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}

However, I'm not certain it's correct to treat removed files as nonentries
in all other cases, so it may really be necessary to create an entire other
function for this.  Any other zsh-workers have an opinion?  (Continue that
part of this thread on zsh-workers, please.)

} I also want to implement a semantic for opening / editing files, that
} is independent of the file type. That is, if I say "open a.html" it
} should open my preferred browser, and if I say "edit a.html" it could
} open my preferred editor. Is such a function already implemented?

Look at Functions/Example/zless for something similar.

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