zsh-workers
 help / color / mirror / code / Atom feed
* Another patch to compctl-examples CVS compctl, and a bug?
@ 1996-07-14  0:34 Bart Schaefer
  1996-07-14  1:55 ` Bart Schaefer
  1996-07-15  1:02 ` Another patch to compctl-examples CVS compctl, and a bug? Zoltan Hidvegi
  0 siblings, 2 replies; 23+ messages in thread
From: Bart Schaefer @ 1996-07-14  0:34 UTC (permalink / raw)
  To: zsh-workers; +Cc: bobg

It's now possible to avoid several external processes in generating the
list of CVS-controlled files in the `cvstargets' function.  The key is
this wonderful "parameter" (boy, is that misnamed) subsitution:

	"${${${(f@)$({<${pref}CVS/Entries} 2>/dev/null)}#/}%%/*}"

This almost bears explaining in and of itself.  The {...} are needed
around the nullcmd input redirection, so that the 2> redirection won't
be improperly parsed as part of the file name (see my previous report).
The $(...) substitution grabs the contents of the CVS/Entries file to
get a list of all files in the current directory that CVS knows about.
This is wrapped in ${(f@)...} to force each line to be interpreted as
a separate word; this works because of the outer double quotes.  Next
is ${...#/} to strip a leading slash from every line of the CVS/Entries
file.  Finally, this is wrapped in ${...%%/*} to strip from each line
everything following the file name itself.

If there's a better way than `for f in ... do echo ... done' to prefix
every element of the resulting array with ${pref}, I'd love to see it.

Now for the bug:  If the ${pref}CVS/Entries file exists, all of this
works fine.  However, if no CVS directory exists at all, the above
subsitution prints a newline to the terminal -- which messes up zle.
The newline is not going into $reply, because using <redisplay> or
<clear-screen> and then continuing a menu completion cycles through
the other choices without further zle confusion.

Where is that newline coming from?

The other interesting (and the slow) part of $reply is:

	${pref}*/**/CVS(:h)

which returns names of any directories below the ${pref} directory that
in turn contain a CVS subdirectory.

Hmm, maybe all that should get added to the comments in the file. :-}

*** Misc/compctl-examples.0	Fri Jul  5 10:57:42 1996
--- Misc/compctl-examples	Sat Jul 13 16:50:40 1996
***************
*** 439,447 ****
  	pref=
      fi
      [[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
!     reply=($(for f in $(cat ${pref}CVS/Entries 2>/dev/null | \
!     		sed 's/^\/\([^\/]*\).*/\1/'); do echo $pref$f; done)
! 	   $(echo ${pref}**/CVS(:h) | sed 's/CVS//'))
  }
  #------------------------------------------------------------------------------
  # RedHat Linux rpm utility
--- 439,448 ----
  	pref=
      fi
      [[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
!     reply=($(for f in \
! 		"${${${(f@)$({<${pref}CVS/Entries} 2>/dev/null)}#/}%%/*}" \
!     		do echo $pref$f; done)
! 	   ${pref}*/**/CVS(:h))
  }
  #------------------------------------------------------------------------------
  # RedHat Linux rpm utility

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[flat|nested] 23+ messages in thread
[parent not found: <17651.199607222123@stone.dcs.warwick.ac.uk>]
* Completion behavior change in 3.0-pre3
@ 1996-07-16  6:00 Bart Schaefer
  1996-07-17  9:52 ` Christoph von Stuckrad
  0 siblings, 1 reply; 23+ messages in thread
From: Bart Schaefer @ 1996-07-16  6:00 UTC (permalink / raw)
  To: zsh-workers

Here's zsh 3.0-pre2:

zagzig[85] echo z*i<TAB>
(feep)
zagzig[85] echo z*i

Here's zsh 3.0-pre3:

zagzig<3> echo z*i<TAB>
(feep)
zagzig<3> echo z\*i

I really prefer the pre2 behavior.  I suspect this has something to do
with Zoltan's simplification of the code in docomplete(), but I'm not
sure what.  Probably replacement of the loop that walks chline with a
single call to inststr(chline)?

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[flat|nested] 23+ messages in thread
[parent not found: <199607191600.SAA08613@bolyai.cs.elte.hu>]

end of thread, other threads:[~1996-07-24 14:30 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-14  0:34 Another patch to compctl-examples CVS compctl, and a bug? Bart Schaefer
1996-07-14  1:55 ` Bart Schaefer
     [not found]   ` <schaefer>
1996-07-14  2:00     ` Bart Schaefer
1996-07-17 21:52     ` Completion behavior change in 3.0-pre3 Bart Schaefer
1996-07-19 19:53     ` Another patch to compctl-examples CVS compctl, and a bug? Bart Schaefer
1996-07-22  7:34       ` Peter Stephenson
1996-07-22  6:53     ` Bug in case stmt with '(' Bart Schaefer
1996-07-15  1:02 ` Another patch to compctl-examples CVS compctl, and a bug? Zoltan Hidvegi
1996-07-15  2:32   ` Bart Schaefer
1996-07-15  4:30     ` Zoltan Hidvegi
1996-07-15  7:03   ` Bart Schaefer
1996-07-15 17:02     ` Bart Schaefer
     [not found] <17651.199607222123@stone.dcs.warwick.ac.uk>
1996-07-23 14:08 ` Bug in case stmt with '(' Zoltan Hidvegi
1996-07-23 16:25   ` Bart Schaefer
     [not found]     ` <schaefer@candle.brasslantern.com>
1996-07-23 20:01       ` Morris M. Siegel
1996-07-23 21:55         ` Bart Schaefer
1996-07-24  8:29           ` Zefram
     [not found]             ` <A.Main@dcs.warwick.ac.uk>
1996-07-24 11:10               ` Bart Schaefer
1996-07-24 14:16                 ` Zoltan Hidvegi
1996-07-24  9:52           ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
1996-07-16  6:00 Completion behavior change in 3.0-pre3 Bart Schaefer
1996-07-17  9:52 ` Christoph von Stuckrad
1996-07-17 15:29   ` Bart Schaefer
     [not found] <199607191600.SAA08613@bolyai.cs.elte.hu>
     [not found] ` <9607211853.ZM979@morgan.com>

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).