* PATCH: Completion for AUTO_CD
@ 2001-06-21 9:17 Bart Schaefer
2001-06-21 9:54 ` Peter Stephenson
2001-06-21 10:22 ` Oliver Kiddle
0 siblings, 2 replies; 5+ messages in thread
From: Bart Schaefer @ 2001-06-21 9:17 UTC (permalink / raw)
To: zsh-workers
This should be pretty self-explanatory, except for the fact that it's
named _autocd because _command is pre-empted for the `command' builtin.
There doesn't seem to be a lot of documentation for the context funcs.
Some of them get mentioned in a few places as if people should know that
they exist (e.g. _default in the use-compctl entry) but that's all, so
I didn't document this one either.
May I add this to 4.0.2?
On a semi-related note, why doesn't _command call `_command_names -e'?
Index: Completion/Zsh/Context/_autocd
===================================================================
RCS file: _autocd
diff -N _autocd
--- /dev/null Tue May 5 13:32:27 1998
+++ Completion/Zsh/Context/_autocd Thu Jun 21 01:55:18 2001
@@ -0,0 +1,5 @@
+#compdef -command-
+
+_command_names
+local ret=$?
+[[ -o autocd ]] && _cd || return ret
Index: Completion/Zsh/Command/_cd
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Zsh/Command/_cd,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 _cd
--- Completion/Zsh/Command/_cd 2001/04/09 20:14:09 1.1.1.1
+++ Completion/Zsh/Command/_cd 2001/06/21 08:48:03
@@ -24,7 +24,7 @@
rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}})
(( $#rep )) && _wanted -C replacement strings expl replacement compadd -a rep
else
- _directory_stack && ret=0
+ [[ CURRENT -gt 1 ]] && _directory_stack && ret=0
if [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then
local tdir tdir2
Index: Completion/Zsh/Type/_command_names
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Zsh/Type/_command_names,v
retrieving revision 1.2
diff -u -r1.2 _command_names
--- Completion/Zsh/Type/_command_names 2001/06/18 18:01:55 1.2
+++ Completion/Zsh/Type/_command_names 2001/06/21 08:54:50
@@ -1,4 +1,4 @@
-#compdef -command-
+#autoload
# The option `-e' if given as the first argument says that we should
# complete only external commands and executable files. This and a
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Completion for AUTO_CD
2001-06-21 9:17 PATCH: Completion for AUTO_CD Bart Schaefer
@ 2001-06-21 9:54 ` Peter Stephenson
2001-06-21 10:22 ` Oliver Kiddle
1 sibling, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2001-06-21 9:54 UTC (permalink / raw)
To: Zsh hackers list
"Bart Schaefer" wrote:
> May I add this to 4.0.2?
Looks OK to me.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
**********************************************************************
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
* Re: PATCH: Completion for AUTO_CD
2001-06-21 9:17 PATCH: Completion for AUTO_CD Bart Schaefer
2001-06-21 9:54 ` Peter Stephenson
@ 2001-06-21 10:22 ` Oliver Kiddle
2001-06-21 10:30 ` Sven Wischnowsky
1 sibling, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2001-06-21 10:22 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
>
> This should be pretty self-explanatory, except for the fact that it's
> named _autocd because _command is pre-empted for the `command' builtin.
I'm not too keen on the name. I'd suggest using _command and renaming
the existing _command, perhaps to _command_builtin (we have an
_jobs_builtin).
My initial thought on seeing your patch was that completion for autocd
already works. This is because of the line in _command_names which adds
executable files and directories. This is there for completing commands
by specifying the full path to them. It is unfortunate that we now get
the directories twice but I can't think of a simple fix.
_cd should also possibly be adding usernames and parameters for the
cdablevars option.
> On a semi-related note, why doesn't _command call `_command_names -e'?
Probably because it pre-dates it.
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Completion for AUTO_CD
2001-06-21 10:22 ` Oliver Kiddle
@ 2001-06-21 10:30 ` Sven Wischnowsky
2001-06-21 10:50 ` Bart Schaefer
0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2001-06-21 10:30 UTC (permalink / raw)
To: zsh-workers
Oliver Kiddle wrote:
> Bart Schaefer wrote:
> >
> > This should be pretty self-explanatory, except for the fact that it's
> > named _autocd because _command is pre-empted for the `command' builtin.
>
> I'm not too keen on the name. I'd suggest using _command and renaming
> the existing _command, perhaps to _command_builtin (we have an
> _jobs_builtin).
Hmhm, seems sensible.
> My initial thought on seeing your patch was that completion for autocd
> already works. This is because of the line in _command_names which adds
> executable files and directories. This is there for completing commands
> by specifying the full path to them. It is unfortunate that we now get
> the directories twice but I can't think of a simple fix.
I was about to mention the same when this mail came. The only thing I
can think of is to make _command_names use only -g, not -/ (it will
revert to directory completion if there is no executable anyway). Or
maybe do that only if autocd is set and _command_names is called from
_autocd. Or something.
> _cd should also possibly be adding usernames and parameters for the
> cdablevars option.
>
> > On a semi-related note, why doesn't _command call `_command_names -e'?
>
> Probably because it pre-dates it.
I think that's the reason, yes. That plus oversight.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Completion for AUTO_CD
2001-06-21 10:30 ` Sven Wischnowsky
@ 2001-06-21 10:50 ` Bart Schaefer
0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2001-06-21 10:50 UTC (permalink / raw)
To: zsh-workers
On Jun 21, 11:22am, Oliver Kiddle wrote:
} Subject: Re: PATCH: Completion for AUTO_CD
}
} > named _autocd because _command is pre-empted for the `command' builtin.
}
} I'm not too keen on the name. I'd suggest using _command and renaming
} the existing _command, perhaps to _command_builtin (we have an
} _jobs_builtin).
I briefly considered that, but then we also ought to rename _vared to
_vared_builtin and rename _in_vared to _vared and so on and so forth,
and I just didn't want to deal with it.
As a lesser consideration, if it's named `_autocd' it's more obvious
that people who don't use autocd could replace it with something else.
} My initial thought on seeing your patch was that completion for autocd
} already works. This is because of the line in _command_names which adds
} executable files and directories.
Unfortunately that doesn't cover cdpath, and cdpath is the main reason I
have autocd set in the first place.
} This is there for completing commands by specifying the full path to
} them.
Yes, that's why I asked why _command doesn't call it.
} _cd should also possibly be adding usernames and parameters for the
} cdablevars option.
Hm.
On Jun 21, 12:30pm, Sven Wischnowsky wrote:
} Subject: Re: PATCH: Completion for AUTO_CD
}
} Oliver Kiddle wrote:
}
} > It is unfortunate that we now get
} > the directories twice but I can't think of a simple fix.
}
} I was about to mention the same when this mail came. The only thing I
} can think of is to make _command_names use only -g, not -/ (it will
} revert to directory completion if there is no executable anyway). Or
} maybe do that only if autocd is set and _command_names is called from
} _autocd. Or something.
_autocd could pass an argument to _command_names, along the lines of -e.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-06-21 10:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-21 9:17 PATCH: Completion for AUTO_CD Bart Schaefer
2001-06-21 9:54 ` Peter Stephenson
2001-06-21 10:22 ` Oliver Kiddle
2001-06-21 10:30 ` Sven Wischnowsky
2001-06-21 10:50 ` 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).