* completing commands
@ 2003-09-03 10:44 Peter Stephenson
2003-09-03 13:57 ` PATCH: " Oliver Kiddle
2003-09-03 14:30 ` Bart Schaefer
0 siblings, 2 replies; 5+ messages in thread
From: Peter Stephenson @ 2003-09-03 10:44 UTC (permalink / raw)
To: Zsh hackers list
When I try to complete a command word with a path I often get,
Completing executable file or directory
<list of directories>
Completing directory
<the same list of directories>
The second list comes from autocd --- it doesn't need to be the same
list, because it can use cdpath, but often it is the same list because
e.g. I typed ./ first. Any thoughts about fixing this? I suspect it's
not trivial because it needs completion functions to be aware of one
another.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* PATCH: Re: completing commands
2003-09-03 10:44 completing commands Peter Stephenson
@ 2003-09-03 13:57 ` Oliver Kiddle
2003-09-03 14:35 ` Bart Schaefer
2003-09-03 14:30 ` Bart Schaefer
1 sibling, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2003-09-03 13:57 UTC (permalink / raw)
To: Zsh hackers list
Peter wrote:
> When I try to complete a command word with a path I often get,
>
> Completing executable file or directory
> <list of directories>
> Completing directory
> <the same list of directories>
>
> The second list comes from autocd --- it doesn't need to be the same
> list, because it can use cdpath, but often it is the same list because
> e.g. I typed ./ first. Any thoughts about fixing this? I suspect it's
> not trivial because it needs completion functions to be aware of one
> another.
In addition to that, it refuses to complete local directories in the
current directory.
There was some effort in _cd to handle the issue but it didn't go far
enough. I think this patch solves the problem.
Index: Completion/Zsh/Command/_cd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_cd,v
retrieving revision 1.6
diff -u -r1.6 _cd
--- Completion/Zsh/Command/_cd 30 Jan 2002 08:47:55 -0000 1.6
+++ Completion/Zsh/Command/_cd 3 Sep 2003 13:31:19 -0000
@@ -67,14 +67,15 @@
# Don't complete local directories in command position, that's
# already handled by _command_names (see _autocd)
- [[ CURRENT -ne 1 ]] &&
+ [[ CURRENT -ne 1 || ( -z "$path[(r).]" && $PREFIX != */* ) ]] &&
alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files -/" "$alt[@]" )
_alternative "$alt[@]" && ret=0
return ret
fi
- _wanted directories expl directory _path_files -/ && ret=0
+ [[ CURRENT -ne 1 ]] && _wanted directories expl directory \
+ _path_files -/ && ret=0
return ret
fi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: completing commands
2003-09-03 10:44 completing commands Peter Stephenson
2003-09-03 13:57 ` PATCH: " Oliver Kiddle
@ 2003-09-03 14:30 ` Bart Schaefer
1 sibling, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2003-09-03 14:30 UTC (permalink / raw)
To: Zsh hackers list
On Sep 3, 11:44am, Peter Stephenson wrote:
}
} Completing executable file or directory
} <list of directories>
} Completing directory
} <the same list of directories>
}
} The second list comes from autocd --- it doesn't need to be the same
} list, because it can use cdpath, but often it is the same list because
} e.g. I typed ./ first. Any thoughts about fixing this?
zstyle ':completion:*:*:-command-:*:directories' group-name executables
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Re: completing commands
2003-09-03 13:57 ` PATCH: " Oliver Kiddle
@ 2003-09-03 14:35 ` Bart Schaefer
2003-09-03 15:55 ` Oliver Kiddle
0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2003-09-03 14:35 UTC (permalink / raw)
To: Zsh hackers list
On Sep 3, 3:57pm, Oliver Kiddle wrote:
}
} In addition to that, it refuses to complete local directories in the
} current directory.
Really? I get them completed in 4.0.6, even without your patch. Can
you show an example of the before and after behavior?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Re: completing commands
2003-09-03 14:35 ` Bart Schaefer
@ 2003-09-03 15:55 ` Oliver Kiddle
0 siblings, 0 replies; 5+ messages in thread
From: Oliver Kiddle @ 2003-09-03 15:55 UTC (permalink / raw)
To: Zsh hackers list
Bart wrote:
> On Sep 3, 3:57pm, Oliver Kiddle wrote:
> }
> } In addition to that, it refuses to complete local directories in the
> } current directory.
>
> Really? I get them completed in 4.0.6, even without your patch. Can
> you show an example of the before and after behavior?
I get them completed in 4.0 too.
The cause is the last part of 15945. It prevents (in _cd) local
directory completion in command completion because "that's already
handled by _command_names". However, if you look at _command_names, you
will see that it only completes directories if
[[ -n "$path[(r).]" || $PREFIX = */* ]]
So my patch makes _cd again complete local directories when that
condition is not true.
That part of 15945 was an attempt to solve the problem Peter reported
but it only covered one of the two places where _cd was completing
directories.
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-09-03 15:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-03 10:44 completing commands Peter Stephenson
2003-09-03 13:57 ` PATCH: " Oliver Kiddle
2003-09-03 14:35 ` Bart Schaefer
2003-09-03 15:55 ` Oliver Kiddle
2003-09-03 14:30 ` 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).