zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@jaist.ac.jp>
To: zsh-workers@sunsite.auc.dk
Subject: Re: CVS completer (Re: PATCH: Re: Completion/User functions again)
Date: 27 Jul 1999 01:26:04 +0900	[thread overview]
Message-ID: <rsq4sirs7hf.fsf@crane.jaist.ac.jp> (raw)
In-Reply-To: Tanaka Akira's message of "26 Jul 1999 13:48:53 +0900"

In article <rsqpv1g2eyy.fsf@crane.jaist.ac.jp>,
  Tanaka Akira <akr@jaist.ac.jp> writes:

> This refines it.

I found the problem with:
  cvs diff ~/xxx/<TAB>

I also tried to complete only modified files for commit and diff.
Since this use stat module, it does not works without dynamic loading by default.

--- Completion/User/_cvs-	Mon Jul 26 23:42:23 1999
+++ Completion/User/_cvs	Tue Jul 27 00:48:42 1999
@@ -37,10 +37,10 @@
       _complete_opts A '' N '' n '' k: "$complete_k" d: '' f '' l '' R '' p '' Q '' q '' c '' s '' r: "$complete_r" D: "$complete_D" j: '' P '' || _cvsrepositories
       ;;
     commit|ci|com) # "+nlRm:fF:r:"
-      _complete_opts n '' l '' R '' m: "$complete_m" f '' F: '' r: "$complete_r" || _cvstargets
+      _complete_opts n '' l '' R '' m: "$complete_m" f '' F: '' r: "$complete_r" || _cvstargets_modified
       ;;
     diff|di|dif) # "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:"
-      _complete_opts a '' b '' c '' d '' e '' f '' h '' i '' l '' n '' p '' s '' t '' u '' w '' 0 '' 1 '' 2 '' 3 '' 4 '' 5 '' 6 '' 7 '' 8 '' 9 '' B '' H '' N '' R '' C: '' D: "$complete_D" F: '' I: '' L: '' U: '' V: '' W: '' k: "$complete_k" r: "$complete_r" || _cvstargets
+      _complete_opts a '' b '' c '' d '' e '' f '' h '' i '' l '' n '' p '' s '' t '' u '' w '' 0 '' 1 '' 2 '' 3 '' 4 '' 5 '' 6 '' 7 '' 8 '' 9 '' B '' H '' N '' R '' C: '' D: "$complete_D" F: '' I: '' L: '' U: '' V: '' W: '' k: "$complete_k" r: "$complete_r" || _cvstargets_modified || _cvstargets
       ;;
     edit) # "+lRa:"
       _complete_opts l '' R '' a: '' || _cvstargets
--- Completion/User/_cvsaddp-	Mon Jul 26 23:42:24 1999
+++ Completion/User/_cvsaddp	Tue Jul 27 01:03:00 1999
@@ -1,6 +1,6 @@
 #autoload
 
-local pref entries
+local qpref pref entries
 _cvsprefix
 _cvsentries
 setopt localoptions unset
@@ -9,5 +9,5 @@
 omit=( $entries ${=cvsignore} )
 [[ -r ~/.cvsignore ]] && omit=( $omit $(<~/.cvsignore) )
 [[ -r ${pref}.cvsignore ]] && omit=( $omit $(<${pref}.cvsignore) )
-eval 'compadd -fp "$pref" - ${all:#('${(j:|:)omit}')}' ||
-  compadd -fp "$pref" - ${pref}*~${pref}CVS(/:t)
+eval 'compadd -fp "$qpref" -W "$pref" - ${all:#('${(j:|:)omit}')}' ||
+  compadd -fp "$qpref" -W "$pref" - ${pref}*~${pref}CVS(/:t)
--- /dev/null	Mon Jul 26 23:54:18 1999
+++ Completion/User/_cvsentries_modified	Tue Jul 27 01:06:39 1999
@@ -0,0 +1,31 @@
+#autoload
+
+local LANG=C
+local OLDTZ="$TZ"; if ! (( $+TZ )); then unset OLDTZ; fi; export TZ=GMT
+
+local line Entries
+typeset -A mtime
+
+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
+else
+  entries=( "${(@)${(@)${(@)${(f@)Entries}:#D}#(D|)/}%%/*}" )
+fi
+
+if (( $+OLDTZ )); then TZ="$OLDTZ"; else unset TZ; fi
--- Completion/User/_cvsprefix-	Mon Jul 26 23:42:24 1999
+++ Completion/User/_cvsprefix	Tue Jul 27 01:00:36 1999
@@ -1,16 +1,18 @@
 #autoload
 
 local f
-pref=$PREFIX
-if [[ $pref != */ ]]; then
-  if [[ $pref = */* ]]; then
-    pref=$pref:h
+qpref=$PREFIX
+if [[ $qpref != */ ]]; then
+  if [[ $qpref = */* ]]; then
+    qpref=$qpref:h
   else
-    pref=
+    qpref=
   fi
 fi
+pref=$~qpref
 if [[ ! -d "$pref" ]]; then
+  qpref=
   pref=
 fi
-[[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
+[[ -n "$pref" && "$pref" != */ ]] && qpref=$qpref/ pref=$pref/
 
--- Completion/User/_cvsremovep-	Mon Jul 26 23:42:24 1999
+++ Completion/User/_cvsremovep	Tue Jul 27 01:03:06 1999
@@ -1,11 +1,11 @@
 #autoload
 
-local pref entries
+local qpref pref entries
 _cvsprefix
 _cvsentries
 setopt localoptions unset
 local omit
 omit=( ${pref}*(D:t) )
-eval 'compadd -fp "$pref" - ${entries:#('${(j:|:)omit}')}' ||
-  compadd -fp "$pref" - ${pref}*~${pref}CVS(/:t)
+eval 'compadd -fp "$qpref" -W "$pref" - ${entries:#('${(j:|:)omit}')}' ||
+  compadd -fp "$qpref" -W "$pref" - ${pref}*~${pref}CVS(/:t)
 
--- Completion/User/_cvstargets-	Mon Jul 26 23:42:24 1999
+++ Completion/User/_cvstargets	Tue Jul 27 01:02:21 1999
@@ -1,7 +1,7 @@
 #autoload
 
-local pref entries
+local qpref pref entries
 _cvsprefix
 _cvsentries
 
-compadd -fp "$pref" - $entries
+compadd -fP "$qpref" -W "$pref" - $entries
--- /dev/null	Mon Jul 26 23:54:18 1999
+++ Completion/User/_cvstargets_modified	Tue Jul 27 01:03:10 1999
@@ -0,0 +1,7 @@
+#autoload
+
+local qpref pref entries
+_cvsprefix
+_cvsentries_modified
+
+compadd -fp "$qpref" -W "$pref" - $entries
-- 
Tanaka Akira


  reply	other threads:[~1999-07-26 16:26 UTC|newest]

Thread overview: 22+ 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 [this message]
1999-07-26 17:10         ` Tanaka Akira
1999-07-27  7:48           ` PATCH: " Bart Schaefer
1999-07-27  8:12             ` 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
  -- strict thread matches above, loose matches on Subject: below --
1999-07-22  6:43 Sven Wischnowsky
1999-07-14 12:46 PATCH: Re: Completion/User functions again Sven Wischnowsky
1999-07-14 13:12 ` Tanaka Akira
1999-07-20 18:05   ` CVS completer (Re: PATCH: Re: Completion/User functions again) Bart Schaefer
1999-07-26  0:52     ` Tanaka Akira

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=rsq4sirs7hf.fsf@crane.jaist.ac.jp \
    --to=akr@jaist.ac.jp \
    --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).