* zsh libs
@ 2006-06-30 12:40 Marc Chantreux
2006-06-30 12:56 ` Peter Stephenson
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Marc Chantreux @ 2006-06-30 12:40 UTC (permalink / raw)
To: zsh-users
hello,
Few days ago, Nikolai Weibull told us about autoload to deal with
namespaces. I'm trying to use this tips for my own libs.
I load my new lib with autoload -U but when i execute the function for
the first time, it wasn't executed.
does anyone knows why ?
> fpath+=$PWD
> cat ldap/new
#autoload ldap/read ldap/write ldap/new
ldap/new () { print "new ..." }
ldap/read () { print "reading ..." }
ldap/write () { print "writting ..." }
> autoload -U !$
autoload -U ldap/new
> ldap/new
> ldap/new
new ...
> autoload -U ldap/write
> ldap/write
writting ...
>
regards,
--
téléphone : 03.90.24.00.19
courriel : marc.chantreux@ulpmm.u-strasbg.fr
---------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: zsh libs
2006-06-30 12:40 zsh libs Marc Chantreux
@ 2006-06-30 12:56 ` Peter Stephenson
2006-06-30 16:27 ` Bart Schaefer
2006-06-30 18:22 ` Prompt truncating Timothy Stone
2006-06-30 19:22 ` Timothy Stone
2 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2006-06-30 12:56 UTC (permalink / raw)
To: Zsh users list
Marc Chantreux wrote:
> hello,
>
> Few days ago, Nikolai Weibull told us about autoload to deal with
> namespaces. I'm trying to use this tips for my own libs.
>
> I load my new lib with autoload -U but when i execute the function for
> the first time, it wasn't executed.
>
> does anyone knows why ?
>
>
> > fpath+=$PWD
> > cat ldap/new
> #autoload ldap/read ldap/write ldap/new
>
> ldap/new () { print "new ..." }
> ldap/read () { print "reading ..." }
> ldap/write () { print "writting ..." }
In zsh's standard form of autoload the file contains just the function
body, so that all that happens when it's first executed is that the
functions contained inside are defined. This is different from other
shells.
However, it's simple to convert the file you've got: just add
ldap/new "$@"
to the end of the file.
--
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] 6+ messages in thread
* Re: zsh libs
2006-06-30 12:56 ` Peter Stephenson
@ 2006-06-30 16:27 ` Bart Schaefer
0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2006-06-30 16:27 UTC (permalink / raw)
To: Zsh users list
On Jun 30, 1:56pm, Peter Stephenson wrote:
}
} However, it's simple to convert the file you've got: just add
}
} ldap/new "$@"
}
} to the end of the file.
Or use
autload -Uk ldap/new
for ksh-style autoloading.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Prompt truncating...
2006-06-30 12:40 zsh libs Marc Chantreux
2006-06-30 12:56 ` Peter Stephenson
@ 2006-06-30 18:22 ` Timothy Stone
2006-06-30 19:22 ` Timothy Stone
2 siblings, 0 replies; 6+ messages in thread
From: Timothy Stone @ 2006-06-30 18:22 UTC (permalink / raw)
To: zsh-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
/From Bash to Z Shell/ has a great chapter on truncating the path in
the prompt for ZSH.
There is some illusion to truncation "by segment" vs. total length:
"...The example therefore shows you how to limit the amount of a
directory printed by the total number of characters rather than by
the numbers of segments in the path."
Page 157-156, Chapter 7
So how to by segment? Is it in the Bash section of this chapter? I
skipped that part. :)
How I do it in tcsh now:
if ($?prompt) then
set prompt = "%n@%m %B[%b%c03%B]%b %% " # doesn't want to work
in ZSH
set cdpath = (~ ~/Documents ~/Projects)
set ellipsis
endif
Basically, total length is nice, but not as nice as by segment, IMHO.
Thanks,
Tim
- --
Timothy Stone | www dot petmystone dot com
Rising Sun, MD | tstone at petmystone dot com
"This Satan's drink [coffee] is so delicious...
we shall cheat Satan by baptizing it."
Pope Clement VIII (1592-1605)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFEpWvmlNb2aYI3YNkRAuh2AJwPVHakUoAAcCAhD6AvpGKu7QKCnQCePx0p
PYvgRibKMvIa32K4D8KzrF0=
=NhAZ
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread
* Prompt truncating...
2006-06-30 12:40 zsh libs Marc Chantreux
2006-06-30 12:56 ` Peter Stephenson
2006-06-30 18:22 ` Prompt truncating Timothy Stone
@ 2006-06-30 19:22 ` Timothy Stone
2006-06-30 20:13 ` Prompt truncating... [CLOSED] Timothy Stone
2 siblings, 1 reply; 6+ messages in thread
From: Timothy Stone @ 2006-06-30 19:22 UTC (permalink / raw)
To: zsh-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
/From Bash to Z Shell/ has a great chapter on truncating the path in
the prompt for ZSH.
There is some illusion to truncation "by segment" vs. total length:
"...The example therefore shows you how to limit the amount of a
directory printed by the total number of characters rather than by
the numbers of segments in the path."
Page 157-156, Chapter 7
So how to by segment? Is it in the Bash section of this chapter? I
skipped that part. :)
How I do it in tcsh now:
if ($?prompt) then
set prompt = "%n@%m %B[%b%c03%B]%b %% " # doesn't want to work
in ZSH
set cdpath = (~ ~/Documents ~/Projects)
set ellipsis
endif
Basically, total length is nice, but not as nice as by segment, IMHO.
Thanks,
Tim
- --
Timothy Stone | www dot petmystone dot com
Rising Sun, MD | tstone at petmystone dot com
"This Satan's drink [coffee] is so delicious...
we shall cheat Satan by baptizing it."
Pope Clement VIII (1592-1605)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFEpWvmlNb2aYI3YNkRAuh2AJwPVHakUoAAcCAhD6AvpGKu7QKCnQCePx0p
PYvgRibKMvIa32K4D8KzrF0=
=NhAZ
-----END PGP SIGNATURE-----
--
Timothy Stone | www dot petmystone dot com
Rising Sun, MD | tstone at petmystone dot com
"This Satan's drink [coffee] is so delicious...
we shall cheat Satan by baptizing it."
Pope Clement VIII (1592-1605)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Prompt truncating... [CLOSED]
2006-06-30 19:22 ` Timothy Stone
@ 2006-06-30 20:13 ` Timothy Stone
0 siblings, 0 replies; 6+ messages in thread
From: Timothy Stone @ 2006-06-30 20:13 UTC (permalink / raw)
To: zsh-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Jun 30, 2006, at 3:22 PM, Timothy Stone wrote:
...snip...
>
> So how to by segment? Is it in the Bash section of this chapter? I
> skipped that part. :)
>
Found it. %C, %. and %c are supported. %1~ and %1 are options as well.
Regards,
Tim
- --
Timothy Stone | www dot petmystone dot com
Rising Sun, MD | tstone at petmystone dot com
"This Satan's drink [coffee] is so delicious...
we shall cheat Satan by baptizing it."
Pope Clement VIII (1592-1605)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFEpYXklNb2aYI3YNkRAiz3AKCITkTSUXP5YNopjITZj4bSc8ax9wCdH2o8
OlLJzfFj4EvyRgx0rqAxFSo=
=UTU/
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-06-30 20:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-30 12:40 zsh libs Marc Chantreux
2006-06-30 12:56 ` Peter Stephenson
2006-06-30 16:27 ` Bart Schaefer
2006-06-30 18:22 ` Prompt truncating Timothy Stone
2006-06-30 19:22 ` Timothy Stone
2006-06-30 20:13 ` Prompt truncating... [CLOSED] Timothy Stone
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).