zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: CVS completer (Re: PATCH: Re: Completion/User functions again)
Date: Tue, 27 Jul 1999 07:48:04 +0000	[thread overview]
Message-ID: <990727074804.ZM25420@candle.brasslantern.com> (raw)
In-Reply-To: <rsq1zdvs5fz.fsf@crane.jaist.ac.jp>

On Jul 27,  2:10am, Tanaka Akira wrote:
} 
} I think _cvs* are only for cvs, there is no necessity to make these
} autoloadable except _cvs.

The following simplifies some of the parameter expansions (use inner quoted
substitutions instead of multiple (@) flags) and fixes a bug where no matches
were generated for `cvs commit' when the `stat' module is not available (now
you may get too many matches, but at least you get some).  The code obviously
was attempting to generate the same output as _cvstargets but had computed
the lines in the CVS/Entries file only in the `stat'-available branch.

There's still a bug, which may be a more general completion problem:  If the
initial prefix of the completion contains a metacharacter (such as '#') that
is inserted quoted, the completer thereafter does not match.  E.g.

zsh% cvs add <C-d>
F#bar F#baz
zsh% cvs add <TAB>
zsh% cvs add F\#<TAB>
(BEEP)
zsh% cvs add F\#<C-d>
(BEEP)
zsh% cvs add F\#<C-b><DEL><C-e>
zsh% cvs add F#<C-d>
F#bar F#baz
zsh% cvs add F#<TAB>
zsh% cvs add F\#

Watch out for tabs converted to spaces in the following ...

Index: Completion/User/_cvs
===================================================================
@@ -157,7 +157,7 @@
 _cvsentries () {
   setopt localoptions nullglob unset
   if [[ -f ${pref}CVS/Entries ]]; then
-      entries=( "${(@)${(@)${(@)${(f@)$(<${pref}CVS/Entries)}:#D}#(D|)/}%%/*}" )
+      entries=( ${${${${(f)"$(<${pref}CVS/Entries)"}:#D}#(D|)/}%%/*} )
   fi
 }
 
@@ -168,26 +168,27 @@
   local line Entries
   typeset -A mtime
 
+  if [[ -f "${pref}CVS/Entries" ]]; then
+    Entries="$(<${pref}CVS/Entries)"
+  fi
+
   if ! zmodload -e stat; then zmodload stat; fi
   if zmodload -e stat; then
-    if [[ -f "${pref}CVS/Entries" ]]; then
-      Entries="$(<${pref}CVS/Entries)"
-      mtime=( "${(@s:/:)${(j:/:)${(@)${(@)${(@)${(M@)${(f@)Entries}:#/*}#/}%/*/*}/\/*\///}}}" )
-      entries=( "${(@)${(@)${(M@)${(f@)Entries}:#D/*}#D/}%%/*}" )
-      builtin stat -n +mtime -F '%a %b %e %T %Y' "$pref${(@k)^mtime}" |
-      while read line
-      do
-	line=${line#$pref}
-	if [[ x"$mtime[${line%% *}]" == x"${line#* }" ]]; then
-	  #print up-to-date "${line%% *}"
-	else
-	  #print locally-modified "${line%% *}"
-	  entries=($entries "${line%% *}")
-	fi
-      done
-    fi
+    mtime=( ${(s:/:)${(j:/:)${${${${(M)${(f)Entries}:#/*}#/}%/*/*}/\\/*\\///}}} )
+    entries=( ${${${(M)${(f)Entries}:#D/*}#D/}%%/*} )
+    builtin stat -n +mtime -F '%a %b %e %T %Y' "$pref${(@k)^mtime}" |
+    while read line
+    do
+      line=${line#$pref}
+      if [[ x"$mtime[${line%% *}]" == x"${line#* }" ]]; then
+        #print up-to-date "${line%% *}"
+      else
+        #print locally-modified "${line%% *}"
+        entries=($entries "${line%% *}")
+      fi
+    done
   else
-    entries=( "${(@)${(@)${(@)${(f@)Entries}:#D}#(D|)/}%%/*}" )
+    entries=( ${${${${(f)Entries}:#D}#(D|)/}%%/*} )
   fi
 
   if (( $+OLDTZ )); then TZ="$OLDTZ"; else unset TZ; fi
@@ -210,7 +211,7 @@
 }
 
 _cvsrevisions () {
-  compadd - "${(@)${(@)${(@M)${(@f)$(cvs -q status -vl .)}:#	*}##[ 	]##}%%[ 	]*}"
+  compadd - ${${${(M)${(f)"$(cvs -q status -vl .)"}:#	*}##[ 	]##}%%[ 	]*}
 }
 
 _cvsrepositories () {
@@ -222,7 +223,7 @@
   else
     compadd - \
       $root/^CVSROOT(:t) \
-      "${(@)${(@M)${(@f)$(<$root/CVSROOT/modules)}:#[^#]*}%%[ 	]*}"
+      ${${(M)${(f)"$(<$root/CVSROOT/modules)"}:#[^#]*}%%[ 	]*}
   fi
 }
 


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1999-07-27  7:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-21 11:27 Sven Wischnowsky
1999-07-21 12:35 ` Tanaka Akira
1999-07-21 15:43   ` Tanaka Akira
1999-07-21 15:54 ` Bart Schaefer
1999-07-25  9:23   ` Tanaka Akira
1999-07-25 11:38     ` Tanaka Akira
1999-07-26  4:48     ` Tanaka Akira
1999-07-26 16:26       ` Tanaka Akira
1999-07-26 17:10         ` Tanaka Akira
1999-07-27  7:48           ` Bart Schaefer [this message]
1999-07-27  8:12             ` PATCH: " Peter Stephenson
1999-07-27 10:07             ` Tanaka Akira
1999-07-27 11:45               ` Tanaka Akira
1999-07-27 13:49                 ` Bart Schaefer
1999-07-27 13:58                   ` Tanaka Akira
1999-07-27 14:11                     ` Tanaka Akira
1999-07-28 16:05                       ` Tanaka Akira
1999-07-27  8:15           ` Peter Stephenson
1999-07-27  8:58             ` Tanaka Akira
1999-08-02  9:47 PATCH: " Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990727074804.ZM25420@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).