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

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

> Although _cvsremovep has same problem too, this fix is not applicable
> because compgen -g does not generate nonexisting filenames.
> 
> Any ideas?

Hm. compset -P is bit dangerous for quoted characters.

is27e1u11% autoload -U compinit; compinit -D
is27e1u11% _tst () { compset -P '*/'; compadd tst }
is27e1u11% compdef _tst tst
is27e1u11% tst \#/<TAB>

Then, I get:

is27e1u11% tst \\\#/tst 

So, I removed compset -P from _cvs.

--- Completion/User/_cvs	Tue Jul 27 19:08:44 1999
+++ Completion/User/_cvs	Tue Jul 27 20:44:07 1999
@@ -196,6 +196,8 @@
   setopt localoptions nullglob unset
   if [[ -f ${pref}CVS/Entries ]]; then
     entries=( ${${${(M)${(f)"$(<${pref}CVS/Entries)"}:#D/*}#D/}%%/*} )
+  else
+    entries=()
   fi
 }
 
@@ -203,6 +205,8 @@
   setopt localoptions nullglob unset
   if [[ -f ${pref}CVS/Entries ]]; then
     entries=( ${${${${(f)"$(<${pref}CVS/Entries)"}:#D}#(D|)/}%%/*} )
+  else
+    entries=()
   fi
 }
 
@@ -213,6 +217,7 @@
     return
   fi
 
+  entries=()
   local line Entries
   typeset -A mtime
 
@@ -242,52 +247,59 @@
 _cvsdirs () {
   if [[ -d ${pref}CVS ]]; then
     _cvsdirentries
-    compadd -fW "$pref" - $entries
+    if (( $#entries )); then
+      compgen "$@" -g '('${(j:|:)entries:q}')'
+    fi
   else
-    _files -W "$pref"
+    _files
   fi
 }
 
 _cvstargets () {
   local qpref pref entries
-  _cvsprefix; compset -P '*/'
+  _cvsprefix
   if [[ -d ${pref}CVS ]]; then
     _cvsentries
-    compgen -W "$pref" -g "(${(j:|:)entries})"
+    if (( $#entries )); then
+      compgen -g '('${(j:|:)entries:q}')'
+    fi
   else
-    _files -W "$pref"
+    _files
   fi
 }
 
 _cvstargets_modified () {
   local qpref pref entries
-  _cvsprefix; compset -P '*/'
+  _cvsprefix
   if [[ -d ${pref}CVS ]]; then
     _cvsentries_modified
-    compgen -W "$pref" -g "(${(j:|:)entries})"
+    if (( $#entries )); then
+      compgen -g '('${(j:|:)entries:q}')'
+    fi
   else
-    _files -W "$pref"
+    _files 
   fi
 }
 
 _cvsremovep () {
   local qpref pref entries
-  _cvsprefix; compset -P '*/'
+  _cvsprefix
   if [[ -d ${pref}CVS ]]; then
     _cvsentries
     setopt localoptions unset
     local omit
     omit=( ${pref}*(D:t) )
-    eval 'compadd -fW "$pref" - ${entries:#('${(j:|:)omit}')}' ||
+    eval 'entries=( ${entries:#('${(j:|:)omit:q}')} )'
+    compadd -P "$qpref" - ${entries:q} ||
     _cvsdirs
   else
-    _files -W "$pref"
+    _files
   fi
 }
 
 _cvsaddp () {
   local qpref pref entries
-  _cvsprefix; compset -P '*/'
+  _cvsprefix
   if [[ -d ${pref}CVS ]]; then
     _cvsentries
     setopt localoptions unset
@@ -296,10 +308,10 @@
     omit=( CVS $entries ${=cvsignore} )
     [[ -r ~/.cvsignore ]] && omit=( $omit $(<~/.cvsignore) )
     [[ -r ${pref}.cvsignore ]] && omit=( $omit $(<${pref}.cvsignore) )
-    compgen -W "$pref" -g "*~*/(${(j:|:)omit})" ||
-    _cvsdirs
+    compgen -g '*~(*/|)('${(j:|:)omit:q}')' ||
+    { _cvsdirentries; compgen -g '('${(j:|:)entries:q}')' }
   else
-    _files -W "$pref"
+    _files
   fi
 }
 
-- 
Tanaka Akira


  reply	other threads:[~1999-07-27 11:45 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           ` PATCH: " Bart Schaefer
1999-07-27  8:12             ` Peter Stephenson
1999-07-27 10:07             ` Tanaka Akira
1999-07-27 11:45               ` Tanaka Akira [this message]
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=rsqg12afha7.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).