zsh-users
 help / color / mirror / code / Atom feed
* Writing Zsh "libraries"
@ 2006-06-19 13:07 Nikolai Weibull
  2006-06-20  7:38 ` Marc Chantreux
  2006-06-20  9:36 ` Peter Stephenson
  0 siblings, 2 replies; 4+ messages in thread
From: Nikolai Weibull @ 2006-06-19 13:07 UTC (permalink / raw)
  To: Zsh Users' List

As I have quite a few utilities written in pure Zsh, I've created a
small library of functions that I often (re)use.  The question is how
to store such a library.  Currently, I've just placed them in
$ZDOTDIR/functions/zap and then added that directory to $fpath.  That
works fine, but I need to modify $fpath and prefix functions with
"zap-".  Then I had the "brilliant" idea of removing the prefixes -
thus "zap-init" becomes "init" - and load them in the following manner
instead:

autoload -U zap/init

Then I simply call the function as "zap/init" ($ZDOTDIR/functions is
in my $fpath as well).

This works and seems to be quite a nice way to handle namespacing, but
perhaps I'm missing something vital here.

Any comments?

  nikolai


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Writing Zsh "libraries"
  2006-06-19 13:07 Writing Zsh "libraries" Nikolai Weibull
@ 2006-06-20  7:38 ` Marc Chantreux
  2006-06-20  9:36 ` Peter Stephenson
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Chantreux @ 2006-06-20  7:38 UTC (permalink / raw)
  To: Zsh Users' List

Hi,

> Then I simply call the function as "zap/init" ($ZDOTDIR/functions is
> in my $fpath as well).

I'm writting my own libs and dream about a czan. I think your idea is
great so i'll use it.


-- 
téléphone : 03.90.24.00.19
courriel  : marc.chantreux@ulpmm.u-strasbg.fr
---------------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Writing Zsh "libraries"
  2006-06-19 13:07 Writing Zsh "libraries" Nikolai Weibull
  2006-06-20  7:38 ` Marc Chantreux
@ 2006-06-20  9:36 ` Peter Stephenson
  2006-06-21  1:09   ` Deliverable Mail
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2006-06-20  9:36 UTC (permalink / raw)
  To: Zsh Users' List

"Nikolai Weibull" wrote:
> autoload -U zap/init
> 
> Then I simply call the function as "zap/init" ($ZDOTDIR/functions is
> in my $fpath as well).
> 
> This works and seems to be quite a nice way to handle namespacing, but
> perhaps I'm missing something vital here.
> 
> Any comments?

I don't suppose anyone intended this to work, but the handling of paths
internally is generally fairly straightforward, so there's no reason why
you shouldn't use it if it works.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Writing Zsh "libraries"
  2006-06-20  9:36 ` Peter Stephenson
@ 2006-06-21  1:09   ` Deliverable Mail
  0 siblings, 0 replies; 4+ messages in thread
From: Deliverable Mail @ 2006-06-21  1:09 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

Can it become standardized behavior then?

Cheers,
Alexy


On 6/20/06, Peter Stephenson <pws@csr.com> wrote:
>
> "Nikolai Weibull" wrote:
> > autoload -U zap/init
> >
> > Then I simply call the function as "zap/init" ($ZDOTDIR/functions is
> > in my $fpath as well).
> >
> > This works and seems to be quite a nice way to handle namespacing, but
> > perhaps I'm missing something vital here.
> >
> > Any comments?
>
> I don't suppose anyone intended this to work, but the handling of paths
> internally is generally fairly straightforward, so there's no reason why
> you shouldn't use it if it works.
>
> --
> Peter Stephenson <pws@csr.com>                  Software Engineer
> CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
> Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070
>
>
> To access the latest news from CSR copy this link into a web browser:
> http://www.csr.com/email_sig.php
>

[-- Attachment #2: Type: text/html, Size: 1625 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-21  1:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-19 13:07 Writing Zsh "libraries" Nikolai Weibull
2006-06-20  7:38 ` Marc Chantreux
2006-06-20  9:36 ` Peter Stephenson
2006-06-21  1:09   ` Deliverable Mail

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).