zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint2@fastmail.com>
To: zsh-workers@zsh.org
Subject: Re: PATH: autoload with explicit path
Date: Sat, 28 Jan 2017 12:37:58 -0800	[thread overview]
Message-ID: <1485635878.2265091.862652176.5670C0E9@webmail.messagingengine.com> (raw)
In-Reply-To: <20170128195639.532f3874@ntlworld.com>

On Sat, Jan 28, 2017, at 11:56 AM, Peter Stephenson wrote:
> On Sat, 28 Jan 2017 11:45:36 -0800 (PST)
> Bart Schaefer <schaefer@brasslantern.com> wrote:
> > Well yes, the option would be on the autoload of the bootstrap function,
> > i.e.,
> > 
> > 	autoload -P /some/hard/path/foo
> > 
> > where "foo" in turn calls "autoload bar" would cause the autoload of bar
> > to inherit /some/hard/path from foo.
> 
> Oh.  That just doubles my suspicion that autoloading bar at the point
> where you autoload foo is the right thing to do and anything else is
> just getting you into the most horrible tangle.

I could copy calendar to /some/hard/path, modify and load it without
daunting task of altering FPATH. It's like a software package. This
simple approach shows that this isn't something really confusing.

For example, I could have in fpath:

/home/user/functions
/usr/local/share/zsh/site-functions
/usr/local/share/zsh/5.2-dev-2/functions
/home/user/functions2

Now, if I invoke "autoload calendar", from where it will be loaded?
First containing directory.

With the new functionality, I could load from anywhere I would want –
this is simpler than maintaining proper FPATH:

autoload -P /home/user/functions2/calendar
autoload -P /usr/local/share/zsh/site-functions/calendar
etc.

Such operation of using absolute paths is zshrc-like, a final stage
where instead of generalizing, we are defining. The rest is still
generalized – all paths in function files are still general. Only the
top (zshrc) is specific.

I think that this will make Zsh so much flexible that setups involving
not typical 2-3 function directories
(FPATH=my-own-functions:Zsh-default-functions), but say 5 paths will get
common – /home/.zsh/calendar1:/home/.zsh/calendar2 – doing this with
FPATH is rather impossible. With FPATH it's natural to add just 1 or 2
additional layers on top of /usr/local/share/zsh/5.2/functions, adding
more is just too demanding.

-- 
Sebastian Gniazdowski


  reply	other threads:[~2017-01-28 20:38 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170127151334epcas2p4c32b57f69fcae22b40b309793eb8ceb6@epcas2p4.samsung.com>
2017-01-27 15:12 ` Sebastian Gniazdowski
2017-01-27 16:24   ` Peter Stephenson
2017-01-27 18:40     ` Sebastian Gniazdowski
2017-01-27 18:44       ` Peter Stephenson
2017-01-27 19:00         ` Sebastian Gniazdowski
2017-01-28 18:05         ` Bart Schaefer
2017-01-28 19:12           ` Peter Stephenson
2017-01-28 19:45             ` Bart Schaefer
2017-01-28 19:56               ` Peter Stephenson
2017-01-28 20:37                 ` Sebastian Gniazdowski [this message]
2017-01-29 12:27             ` Sebastian Gniazdowski
2017-01-29 16:11               ` Bart Schaefer
2017-01-29 17:32                 ` Sebastian Gniazdowski
2017-01-29 18:37                   ` Bart Schaefer
2017-01-29 21:53                     ` Vin Shelton
2017-01-30 10:06                       ` Peter Stephenson
2017-01-29 17:58                 ` Peter Stephenson
2017-01-30 11:37                   ` Sebastian Gniazdowski
2017-01-30 11:55                     ` Peter Stephenson
2016-12-11 22:18 Peter Stephenson
2016-12-12 16:05 ` Bart Schaefer
2016-12-12 16:31   ` Peter Stephenson
2016-12-12 18:09     ` Bart Schaefer
2017-01-10 19:31     ` Peter Stephenson
2017-01-11 11:42       ` Peter Stephenson
2017-01-11 20:51         ` Peter Stephenson
2017-01-12 20:42           ` Peter Stephenson
2017-01-13 18:04           ` Peter Stephenson
2017-01-16 10:37             ` Peter Stephenson
2017-01-16 15:04               ` Daniel Shahaf
2017-01-16 15:48                 ` Peter Stephenson
2017-01-16 15:22               ` Bart Schaefer
2017-01-16 15:59                 ` Peter Stephenson
     [not found]                   ` <CAHYJk3SB1NDj6y5TRHHsAVsyjHfZQhTzMRzTR2c-SVEc9oAwzA@mail.gmail.com>
2017-01-24 11:10                     ` Peter Stephenson
2017-01-11 21:13         ` Peter Stephenson

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=1485635878.2265091.862652176.5670C0E9@webmail.messagingengine.com \
    --to=psprint2@fastmail.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).