Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why do my autoloaded functions not autoload [the first time]?

autoload functions
0
10 Posted

Why do my autoloaded functions not autoload [the first time]?

0
10

The problem is that there are two possible ways of autoloading a function (see the AUTOLOADING FUNCTIONS section of the zsh manual page zshmisc for more detailed information): • The file contains just the body of the function, i.e. there should be no line at the beginning saying function foo { or foo () {, and consequently no matching } at the end. This is the traditional zsh method. The advantage is that the file is called exactly like a script, so can double as both. To define a function xhead () { print -n “\033]2;$*\a”; }, the file would just contain print -n “\033]2;$*\a”. • The file contains the entire definition, and maybe even other code: it is run when the function needs to be loaded, then the function itself is called up. This is the method in ksh. To define the same function xhead, the whole of the usual definition should be in the file. In old versions of zsh, before 3.0, only the first behaviour was allowed, so you had to make sure the file found for autoload just containe

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123