zsh-workers
 help / color / mirror / code / Atom feed
* _command_names and path
@ 2002-01-21 17:28 Clint Adams
  2002-01-22 10:48 ` Sven Wischnowsky
  0 siblings, 1 reply; 4+ messages in thread
From: Clint Adams @ 2002-01-21 17:28 UTC (permalink / raw)
  To: zsh-workers

_command_names will complete executable files in the current
directory even if "." isn't in the path.  What's the best way to
avoid this?


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

* Re: _command_names and path
  2002-01-21 17:28 _command_names and path Clint Adams
@ 2002-01-22 10:48 ` Sven Wischnowsky
  2002-01-27 20:43   ` Clint Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2002-01-22 10:48 UTC (permalink / raw)
  To: zsh-workers


Clint Adams wrote:

> _command_names will complete executable files in the current
> directory even if "." isn't in the path.  What's the best way to
> avoid this?

Probably changing _command_names to use `_files -P/ -W/ ...' if `.' is
not in $path.


Bye
  Sven

-- 
Sven Wischnowsky                           wischnow@berkom.de


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

* Re: _command_names and path
  2002-01-22 10:48 ` Sven Wischnowsky
@ 2002-01-27 20:43   ` Clint Adams
  2002-01-28 16:31     ` Sven Wischnowsky
  0 siblings, 1 reply; 4+ messages in thread
From: Clint Adams @ 2002-01-27 20:43 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-workers

> Probably changing _command_names to use `_files -P/ -W/ ...' if `.' is
> not in $path.

Index: Completion/Zsh/Type/_command_names
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_command_names,v
retrieving revision 1.3
diff -u -r1.3 _command_names
--- Completion/Zsh/Type/_command_names	2001/06/21 09:33:16	1.3
+++ Completion/Zsh/Type/_command_names	2002/01/27 20:42:15
@@ -8,8 +8,17 @@
 
 defs=(
   'commands:external command:compadd -k commands'
-  'executables:executable file or directory:_path_files -/g \*\(-\*\)'
 )
+
+if [[ -n "$path[(r).]" ]]; then
+  defs=( "$defs[@]"
+         'executables:executable file or directory:_path_files -/g \*\(-\*\)'
+  )
+else
+  defs=( "$defs[@]"
+         'executables:executable file or directory:_files -P/ -W/ -/g \*\(-\*\)'
+  )
+fi
 
 if [[ "$1" = -e ]]; then
   shift


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

* Re: _command_names and path
  2002-01-27 20:43   ` Clint Adams
@ 2002-01-28 16:31     ` Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2002-01-28 16:31 UTC (permalink / raw)
  To: zsh-workers


Clint Adams wrote:

> > Probably changing _command_names to use `_files -P/ -W/ ...' if `.' is
> > not in $path.
> 
> ...
> +
> +if [[ -n "$path[(r).]" ]]; then
> +  defs=( "$defs[@]"
> +         'executables:executable file or directory:_path_files -/g \*\(-\*\)'
> +  )
> +else
> +  defs=( "$defs[@]"
> +         'executables:executable file or directory:_files -P/ -W/ -/g \*\(-\*\)'
> +  )
> +fi

I've been thinking about this, too, at the weekend. We need to
complete files after things like `./<TAB>', too.

So we can make this slightly simpler.

Bye
  Sven

Index: Completion/Zsh/Type/_command_names
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_command_names,v
retrieving revision 1.4
diff -u -r1.4 _command_names
--- Completion/Zsh/Type/_command_names	2002/01/27 21:57:54	1.4
+++ Completion/Zsh/Type/_command_names	2002/01/28 16:31:03
@@ -10,15 +10,10 @@
   'commands:external command:compadd -k commands'
 )
 
-if [[ -n "$path[(r).]" ]]; then
+[[ -n "$path[(r).]" || $PREFIX = */* ]] &&
   defs=( "$defs[@]"
          'executables:executable file or directory:_path_files -/g \*\(-\*\)'
   )
-else
-  defs=( "$defs[@]"
-         'executables:executable file or directory:_files -P/ -W/ -/g \*\(-\*\)'
-  )
-fi
 
 if [[ "$1" = -e ]]; then
   shift

-- 
Sven Wischnowsky                           wischnow@berkom.de


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

end of thread, other threads:[~2002-01-28 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-21 17:28 _command_names and path Clint Adams
2002-01-22 10:48 ` Sven Wischnowsky
2002-01-27 20:43   ` Clint Adams
2002-01-28 16:31     ` Sven Wischnowsky

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