zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Update _twisted completion
Date: Mon, 04 Feb 2013 17:17:41 +0000	[thread overview]
Message-ID: <20130204171741.28122650@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20130204164844.GM2279@ragnarok.teratorn.org>

On Mon, 04 Feb 2013 11:48:44 -0500
"Eric P. Mangold" <eric@teratorn.org> wrote:
> Im glad my little innovations have raised these questions. I
> would like very much for there to be a system whereby software authors
> could more easily take charge of supplying their own shell-completion
> functionality as part of the software distribution, instead of relying on
> static functions shipped with zsh. I've seen several other projcts in the
> past that ship/generate their own functions, and we could probably all
> benefit from using an officially supported protocol.

It should be as easy as putting that function in
/usr/share/zsh/site-functions, or equivalent.  That's already in the
fpath ahead of the standard completion directory/directories, so will be
picked up by compinit, which already scans the entire fpath --- that
should be all you need.

There needs to be some interaction between the two utilities so
the utility can supply the information where zsh can find it.  I don't
think it's going to get much simpler than that.

The only difficulty would appear to be ensuring you've got the right
site-functions directory for the version or versions of zsh.  You could
do something like the following on installation:

for testdir in $path; do
  if [[ -x $testdir/zsh ]]; then
    sitefndir="$(zsh -cf 'print -l $fpath' | grep 'site-functions$' | head -1)"
    [[ -d $sitefndir ]] && cp my_completion_files $sitefndir
  fi
done

The alternative is to add some file to an initialisation directory that
sets the fpath for you early on (something run from /etc/zshrc would be
OK, something from /etc/zshenv would be good enough, something only from
/etc/zprofile wouldn't).  Distributions already have ways of doing this
and you probably wouldn't want to reinvent the wheel.

pws


  reply	other threads:[~2013-02-04 17:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-03 17:53 Eric P. Mangold
2013-02-04  4:26 ` Phil Pennock
2013-02-04 16:48   ` Eric P. Mangold
2013-02-04 17:17     ` Peter Stephenson [this message]
2013-02-04 17:31     ` Phil Pennock
2013-02-04 19:01       ` Eric P. Mangold
2013-02-04 19:11         ` Phil Pennock
2013-02-04 18:38     ` Bart Schaefer
2013-02-05 10:05   ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130204171741.28122650@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).