Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: The default $fpath



Hello Tanu,

Tanu Kaskinen wrote:
> Let's assume that I write a program, let's call it "Foo". I want to support Zsh
> completion for Foo, so I write a shell completion script. By default, if
> someone builds Foo from source, Foo should be installed under prefix
> /usr/local. Distributions will install Foo under prefix /usr.
>
> Regardless of whether Foo is installed under /usr or /usr/local, I want the Zsh
> completion to Just Work. I think it should not matter whether the Zsh
> completion is installed under /usr/share/zsh/site-functions or
> /usr/local/share/zsh/site-functions, the completion script should be picked up
> by Zsh either way.
>
> On some distributions this appears to work, but not all. At least Fedora's Zsh
> doesn't include /usr/local/share/zsh/site-functions in the default $fpath. This
> doesn't seem to be Fedora's fault. As far as I can see, Zsh upstream doesn't
> include /usr/local/share/zsh/site-functions in $fpath if the install prefix is
> /usr.
>
> Would a patch be accepted that adds /usr/local/share/zsh/site-functions to
> $fpath always, no matter what the install prefix is?

I think this is a problem that should be tackled in vendor packages.

Here's how we do it in debian land, using build-time parameters passed
to the ‘configure’ script: We set the ‘site-functions’ location to
/usr/local by using:

  --enable-site-fndir=/usr/local/share/zsh/site-functions

This solves the problem of site-specific additions out of the scope of
the package system. Now there's the problem, that other packages, that
may want to install zsh completions can't just write to /usr/local... To
solve that we use

  --enable-additional-fpath=/usr/share/zsh/vendor-functions,/usr/share/zsh/vendor-completions

And we just tell other packages to install completions to

  /usr/share/zsh/vendor-completions

This would solve what you're asking for, in addition to leaving a clean
place for completions from other packages in a vendor's repository.


Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



Messages sorted by: Reverse Date, Date, Thread, Author