zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk
Subject: Re: _files does not list files after foo/
Date: Tue, 27 Jul 1999 16:07:13 +0200	[thread overview]
Message-ID: <9907271407.AA36557@ibmth.df.unipi.it> (raw)
In-Reply-To: "Tanaka Akira"'s message of "25 Jul 1999 01:29:38 DFT." <rsq673aj9jh.fsf@crane.jaist.ac.jp>

Tanaka Akira wrote:
> Z(2):akr@is27e1u11% zsh -f         
> is27e1u11% autoload -U compinit; compinit -D
> is27e1u11% gunzip ./<TAB>
> 
> After above operation, zsh does not list files in current directory.
> 
> OK, I know that the behaviour is intentional as:
> 
> But it is confusing in this case.
> I suppose that there should be the way to disable the hack.

Yes, in fact in the case of something like `_files *(*)' it's preventing
the second call of _path_files from trying to look for directories when
there aren't any other matches, which is quite a serious problem (note that
it only arises right after the /, but with menu completion that's where I
mostly use completion nowadays).  This turns it off unless the path_keepdir
configuration key is set.  Maybe Sven can think of something more subtle to
do.

--- Completion/Core/_path_files.bak	Tue Jul 27 15:54:39 1999
+++ Completion/Core/_path_files	Tue Jul 27 15:54:49 1999
@@ -260,7 +260,14 @@
       # original string in such a case so that the command line doesn't 
       # change but other completers still think there are matches.
 
-      if [[ -z "$tpre$tsuf" && "$pre" = */ && -z "$suf" ]]; then
+      # Problem:  this seems to stop _files from finding directory
+      # completions if there were no file completions, for
+      # example `_files *(*)' no longer completes subdirectories after
+      # a /.  For now, make this a configuration option, but
+      # probably it needs to be done better.
+
+      if [[ -n "$compconfig[path_keepdir]" && -z "$tpre$tsuf" &&
+	"$pre" = */ && -z "$suf" ]]; then
         compadd -nQS '' - "$linepath$donepath$orig"
         tmp4=-
       fi
--- Doc/Zsh/compsys.yo.bak	Fri Jul 23 13:41:43 1999
+++ Doc/Zsh/compsys.yo	Tue Jul 27 16:00:27 1999
@@ -728,13 +728,27 @@
 `tt(-S)', `tt(-q)', `tt(-r)', and `tt(-R)' options from the
 tt(compadd) builtin.
 
-Finally, the tt(_path_files) function supports two configuration keys.
-If tt(path_expand) is set to any non-empty string, the partially
+Finally, the tt(_path_files) function supports three configuration keys.
+startitem()
+item(tt(path_expand))(
+If this is set to any non-empty string, the partially
 typed path from the line will be expanded as far as possible even if
-trailing pathname components can not be completed. And if
-tt(path_cursor) is set to a non-empty string, the cursor will be left
+trailing pathname components can not be completed.
+)
+item(tt(path_cursor))(
+If this is set to a non-empty string, the cursor will be left
 after the first ambiguous pathname component even when menucompletion
 is used.
+)
+item(tt(path_keepdir))(
+If this is set to a non-empty string, then if completion immediately after
+a slash fails, treat the original string as a successful completion.  This
+prevents a valid directory being treated as a candidate for correction.
+However, it has the side effect that a pattern completion, such as
+`tt(files -g *(*))', will no longer try to complete directories in this
+position if there are no file matches.
+)
+enditem()
 )
 item(tt(_parameters))(
 This should be used to complete parameter names if you need some of the

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


  reply	other threads:[~1999-07-27 14:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-24 16:29 Tanaka Akira
1999-07-27 14:07 ` Peter Stephenson [this message]
1999-08-02 13:40 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=9907271407.AA36557@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --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).