* Re: autoloading questions
@ 1999-10-15 9:50 Sven Wischnowsky
0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-10-15 9:50 UTC (permalink / raw)
To: zsh-users
Bart Schaefer wrote:
> BTW, this question made me notice that it's not a good idea to do
>
> autoload fun
> zmodload parameter
> noglob vared functions[fun]
>
> unless you're very careful about whether you press enter.
Ouch. But if you leave with ^G... hm, should we change `functions'
somehow? I can't think of anything could just now, though.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: autoloading questions
1999-10-14 15:54 Adam Spiers
@ 1999-10-15 9:18 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-10-15 9:18 UTC (permalink / raw)
To: zsh users mailing list
On Oct 14, 4:54pm, Adam Spiers wrote:
} Subject: autoloading questions
}
} 1. What's the best way of checking whether an autoload of a function
} will succeed? (I mean the actual loading, rather than the
} invocation of the `autoload' built-in.)
I can't think of anything except
function testauto {
emulate -L zsh
local f
f=( $^fpath/$1(N) )
[[ -n $f[1] ]] && $ZSH_NAME -ns < $f[1]
}
That requires forking an extra shell, though, and it's still nothing
more than a syntax check.
} 2. How can I manually cause an autoloaded function to be loaded
} without actually running it
Try this:
function loadauto {
emulate -L zsh
local f
f=( $^fpath/$1(N) )
eval "function $1 {
$(< $f[1])
}"
}
(You can replace $(< $f[1]) with $mapfile[$f[1]] if you use that module,
but $(<...) is already a non-forking special-case.)
Actually, I guess calling loadauto would tell you whether the autoload
succeeds, so it sort of answers both questions ....
BTW, this question made me notice that it's not a good idea to do
autoload fun
zmodload parameter
noglob vared functions[fun]
unless you're very careful about whether you press enter.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* autoloading questions
@ 1999-10-14 15:54 Adam Spiers
1999-10-15 9:18 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Adam Spiers @ 1999-10-14 15:54 UTC (permalink / raw)
To: zsh users mailing list
1. What's the best way of checking whether an autoload of a function
will succeed? (I mean the actual loading, rather than the
invocation of the `autoload' built-in.)
2. How can I manually cause an autoloaded function to be loaded
without actually running it, even if there is a typical
foo "$@"
line at the end of the file?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-10-15 9:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-15 9:50 autoloading questions Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
1999-10-14 15:54 Adam Spiers
1999-10-15 9:18 ` Bart Schaefer
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).