* Adding new completions to zsh
@ 2004-02-26 3:39 Eric Mangold
2004-02-26 10:29 ` Peter Stephenson
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Eric Mangold @ 2004-02-26 3:39 UTC (permalink / raw)
To: zsh-users
Hello,
I've written completion functions for the 'mktap' and 'twistd' command of
the Twisted project, http://twistedmatrix.com and I would like advice on
getting this functionality included in zsh.
The problem I'm facing is keeping the completions in zsh up-to-date.
Twisted development happens at a fairly rapid pace and while command
options aren't changing every day, in my judgement it would be annoying
for our users (many of whom use zsh already) to be stuck with the static
set of completion functionality bundled in any given zsh release.
My idea for allowing greater flexibility is to bundle the actual zsh
completion functionality as part of the Twisted distribution and give zsh
a "stub" that will use the completion functions that are bundled with
Twisted.
Has anyone ever done this before? What do you all think?
-Eric
P.S. maybey this should this be on zsh-dev, but I assume everyone reads
zsh-users.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding new completions to zsh
2004-02-26 3:39 Adding new completions to zsh Eric Mangold
@ 2004-02-26 10:29 ` Peter Stephenson
2004-02-26 21:42 ` Eric Mangold
2004-02-26 11:12 ` Oliver Kiddle
2004-02-26 21:37 ` Dominic Mitchell
2 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2004-02-26 10:29 UTC (permalink / raw)
To: zsh-users
On Wed, 25 Feb 2004 20:39:22 -0700
Eric Mangold <teratorn@world-net.net> wrote:
> My idea for allowing greater flexibility is to bundle the actual zsh
> completion functionality as part of the Twisted distribution and give zsh
> a "stub" that will use the completion functions that are bundled with
> Twisted.
This sounds OK... I presume you're going to add some hook to the main Twisted
program (or some configuration utility) that reports the installation location
so that the functions distribution with zsh can find the functions
distributed with Twisted.
As far as I know, nobody's done that yet, but it seems a sensible way of
doing it.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding new completions to zsh
2004-02-26 3:39 Adding new completions to zsh Eric Mangold
2004-02-26 10:29 ` Peter Stephenson
@ 2004-02-26 11:12 ` Oliver Kiddle
2004-02-26 21:37 ` Dominic Mitchell
2 siblings, 0 replies; 6+ messages in thread
From: Oliver Kiddle @ 2004-02-26 11:12 UTC (permalink / raw)
To: Eric Mangold; +Cc: zsh-users
Eric Mangold wrote:
> My idea for allowing greater flexibility is to bundle the actual zsh
> completion functionality as part of the Twisted distribution and give zsh
> a "stub" that will use the completion functions that are bundled with
> Twisted.
>
> Has anyone ever done this before? What do you all think?
It's never been done before but it makes some sense.
Thinking about how this could work, the function distributed with zsh
could start with something like this:
local dir FPATH="$FPATH"
dir=${commands[twistd]:h:h}/share/twistd
if [[ -r $dir/_twistd ]]; then
fpath=( $dir $fpath )
autoload -XU
fi
The dir assignment is a crude way of trying to find the directory
containing the function in the twisted distribution. Hopefully you have
some hook which will do a better job. It then checks if it has found
the function. If so, it adds the directory to beginning of the function
search path and uses autoload to load the replacement function.
After this section, we could fallback on a potentially out-of-date
completion for twistd. It'd be good if the zsh CVS view of that could
be kept reasonably up-to-date though.
Oliver
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding new completions to zsh
2004-02-26 3:39 Adding new completions to zsh Eric Mangold
2004-02-26 10:29 ` Peter Stephenson
2004-02-26 11:12 ` Oliver Kiddle
@ 2004-02-26 21:37 ` Dominic Mitchell
2004-02-26 21:56 ` Eric Mangold
2 siblings, 1 reply; 6+ messages in thread
From: Dominic Mitchell @ 2004-02-26 21:37 UTC (permalink / raw)
To: Eric Mangold; +Cc: zsh-users
On Wed, Feb 25, 2004 at 08:39:22PM -0700, Eric Mangold wrote:
> My idea for allowing greater flexibility is to bundle the actual zsh
> completion functionality as part of the Twisted distribution and give zsh
> a "stub" that will use the completion functions that are bundled with
> Twisted.
Would it not make more sense to get your extensions bundled with Twisted
and then installed in the site-functions directory? This is what the
FreeBSD portupgrade commands do and it works great!
-Dom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding new completions to zsh
2004-02-26 10:29 ` Peter Stephenson
@ 2004-02-26 21:42 ` Eric Mangold
0 siblings, 0 replies; 6+ messages in thread
From: Eric Mangold @ 2004-02-26 21:42 UTC (permalink / raw)
To: zsh-users
On Thu, 26 Feb 2004 10:29:13 +0000, Peter Stephenson <pws@csr.com> wrote:
> On Wed, 25 Feb 2004 20:39:22 -0700
> Eric Mangold <teratorn@world-net.net> wrote:
>> My idea for allowing greater flexibility is to bundle the actual zsh
>> completion functionality as part of the Twisted distribution and give
>> zsh
>> a "stub" that will use the completion functions that are bundled with
>> Twisted.
>
> This sounds OK... I presume you're going to add some hook to the main
> Twisted
> program (or some configuration utility) that reports the installation
> location
> so that the functions distribution with zsh can find the functions
> distributed with Twisted.
Since Twisted is a Python package I can (fairly easily) use the standard
python mechanisms to locate files or otherwise pull data out of that
package.
So the first time someone tries one of the completions it will call python
to acquire the completion info, and then I guess I'll cache that in a
global variable to speed it up for further completions done in that shell
session.
-Eric
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding new completions to zsh
2004-02-26 21:37 ` Dominic Mitchell
@ 2004-02-26 21:56 ` Eric Mangold
0 siblings, 0 replies; 6+ messages in thread
From: Eric Mangold @ 2004-02-26 21:56 UTC (permalink / raw)
To: Dominic Mitchell; +Cc: zsh-users
On Thu, 26 Feb 2004 21:37:04 +0000, Dominic Mitchell
<dom@happygiraffe.net> wrote:
> On Wed, Feb 25, 2004 at 08:39:22PM -0700, Eric Mangold wrote:
>> My idea for allowing greater flexibility is to bundle the actual zsh
>> completion functionality as part of the Twisted distribution and give
>> zsh
>> a "stub" that will use the completion functions that are bundled with
>> Twisted.
>
> Would it not make more sense to get your extensions bundled with Twisted
> and then installed in the site-functions directory? This is what the
> FreeBSD portupgrade commands do and it works great!
I've considered this, however I don't believe it is ideal for this
specific situation. There are a couple different scenarios where using the
completion info installed by Twisted's installion routine would be
undesireable.
First, there's no guarantee that the user even has Twisted /installed/. It
is very common for the users and developers of Twisted to be working
directly out of a CVS checkout. They will do this by adding the directory
containing the CVS checkout to their PYTHONPATH env var.
Secondly, the user may have a release version of Twisted installed yet be
using another version somewhere else. Such as CVS or having simply
extracted a newer Twisted release tarball in their home dir and set
PYTHONPATH accordingly.
So asking python is the only sure way to provide info that is accurate for
what the user is presently doing.
-Eric
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-02-26 22:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-26 3:39 Adding new completions to zsh Eric Mangold
2004-02-26 10:29 ` Peter Stephenson
2004-02-26 21:42 ` Eric Mangold
2004-02-26 11:12 ` Oliver Kiddle
2004-02-26 21:37 ` Dominic Mitchell
2004-02-26 21:56 ` Eric Mangold
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).