zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: better control for _cd
@ 1999-12-03 15:34 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-12-03 15:34 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On Dec 3,  2:13pm, Sven Wischnowsky wrote:
> } Subject: PATCH: better control for _cd
> }
> } This makes _cd use the tags local-directories and path-directories to
> } decide if those in the cwd and/or those in $cdpath should be
> } completed.
> 
> Is that really a good idea?  In the event that the same name can be
> resolved either way, "cd" is always going to change to the same one.
> Seeing completions only for one or the other case would be misleading.

Hm. Isn't that a matter of personal taste? And note that the patch
keeps the default behaviour of showing/using all directories. You
have to change _sort_tags explicitly to get only one of them, and when 
you do that you probably know what you are doing.

It would probably only be irritating if you choose to try *only* the
directories in $cdpath or to try them *first*. Do you think that our
users need to be saved from this? I.e. should we change _cd to
explicitly disallow this?

> This is one case where I think it should always complete them all and
> always order the groups the way that "cd" is going to choose them
> (that is, local directories first).

The patch also makes directories in `.' be listed first... maybe
that'll help? And with menu-completion you'll get those names first,
of course. Err... one could say that the patch does the ordering you
want.


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: better control for _cd
  1999-12-03 13:13 Sven Wischnowsky
@ 1999-12-03 15:24 ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-12-03 15:24 UTC (permalink / raw)
  To: zsh-workers

On Dec 3,  2:13pm, Sven Wischnowsky wrote:
} Subject: PATCH: better control for _cd
}
} This makes _cd use the tags local-directories and path-directories to
} decide if those in the cwd and/or those in $cdpath should be
} completed.

Is that really a good idea?  In the event that the same name can be
resolved either way, "cd" is always going to change to the same one.
Seeing completions only for one or the other case would be misleading.

This is one case where I think it should always complete them all and
always order the groups the way that "cd" is going to choose them
(that is, local directories first).

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH: better control for _cd
@ 1999-12-03 13:13 Sven Wischnowsky
  1999-12-03 15:24 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1999-12-03 13:13 UTC (permalink / raw)
  To: zsh-workers


This makes _cd use the tags local-directories and path-directories to
decide if those in the cwd and/or those in $cdpath should be
completed.

I.e. you can put in your _sort_tags:

  *::cd:*)
      comptry local-directories
      comptry path-directories
      ;;

to first complete only the directories in $PWD and the ones in $cdpath 
only if that fails.

Bye
 Sven

diff -u -r oldcompletion/Builtins/_cd Completion/Builtins/_cd
--- oldcompletion/Builtins/_cd	Fri Dec  3 10:22:05 1999
+++ Completion/Builtins/_cd	Fri Dec  3 14:07:02 1999
@@ -33,11 +33,13 @@
   # Note we need a tilde because cdablevars also allows user home
   # directories, hence we also need nonomatch to suppress error messages.
   if [[ -o cdablevars && -n "$PREFIX" && ! -d ${tdir::=${PREFIX%%/*}} &&
-    -d ${~tdir2::="~$tdir"} ]]; then
+        -d ${~tdir2::="~$tdir"} ]]; then
       PREFIX="~$PREFIX"
       _path_files -/
   else
-    _path_files -W "(. $cdpath)" -/
+    _alternative \
+        'local-directories:local directories:_path_files -/' \
+	'path-directories: directories in cdpath:_path_files -W \(${cdpath:#.}\) -/'
   fi
 else
   _path_files -/
diff -u olddoc/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- olddoc/Zsh/compsys.yo	Fri Dec  3 10:21:51 1999
+++ Doc/Zsh/compsys.yo	Fri Dec  3 14:09:05 1999
@@ -622,6 +622,10 @@
 item(tt(keysyms))(
 for names of X keysyms
 )
+item(tt(local-directories))(
+for names of directories in the current working directory when
+completing for the tt(cd) builtin command
+)
 item(tt(libraries))(
 for names of system libraries
 )
@@ -666,6 +670,10 @@
 )
 item(tt(parameters))(
 for names of parameters
+)
+item(tt(path-directories))(
+for names of directories in directories from the tt(cdpath) array when
+completing for the tt(cd) builtin command
 )
 item(tt(paths))(
 used to look up the values of the tt(expand) and tt(cursor) styles

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-12-03 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-03 15:34 PATCH: better control for _cd Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-12-03 13:13 Sven Wischnowsky
1999-12-03 15:24 ` Bart Schaefer

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).