Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: autoload
On 09/14/2015 08:48 PM, Bart Schaefer wrote:
On Sep 14, 7:48pm, Ray Andrews wrote:
}
} One more thing if you would Bart: get me started with combining zcompile
} with autoload as you mentioned. It sounds like a good idea but I can't
} find anything on it.
Thanks, I'll throw myself at it. This sounds like very satisfying stuff
for philosophical
reasons--I prefer directness over convenience most of the time and an
explicit
statement of where functions actually are turns my crank. That's the
reason I liked:
autoload /usr/local/share/zsh/site-functions/n-*(N-.:t)
... because it's explicit. Alas it turns out to be disharmonious with
the nature of the
thing, like teaching a cat to fetch.
Finally, for Ray, you can for example replace your entire $fpath with
a single ZWC file:
Marvelous:
6 HP-w5--5-Debian1 /aWorking/Zsh 2$ echo $fpath
/usr/local/share/zsh/site-functions /usr/share/zsh/vendor-functions
/usr/share/zsh/vendor-completions /usr/share/zsh/functions/Calendar
/usr/share/zsh/functions/Chpwd /usr/share/zsh/functions/Completion
/usr/share/zsh/functions/Completion/AIX
/usr/share/zsh/functions/Completion/BSD
/usr/share/zsh/functions/Completion/Base
/usr/share/zsh/functions/Completion/Cygwin
/usr/share/zsh/functions/Completion/Darwin
/usr/share/zsh/functions/Completion/Debian
/usr/share/zsh/functions/Completion/Linux
/usr/share/zsh/functions/Completion/Mandriva
/usr/share/zsh/functions/Completion/Redhat
/usr/share/zsh/functions/Completion/Solaris
/usr/share/zsh/functions/Completion/Unix
/usr/share/zsh/functions/Completion/X
/usr/share/zsh/functions/Completion/Zsh
/usr/share/zsh/functions/Completion/openSUSE
/usr/share/zsh/functions/Exceptions /usr/share/zsh/functions/MIME
/usr/share/zsh/functions/Misc /usr/share/zsh/functions/Newuser
/usr/share/zsh/functions/Prompts /usr/share/zsh/functions/TCP
/usr/share/zsh/functions/VCS_Info
/usr/share/zsh/functions/VCS_Info/Backends /usr/share/zsh/functions/Zftp
/usr/share/zsh/functions/Zle
... is deeply disturbing on principal, I don't want my shell searching
the world for my functions, I want it to *know* where they are and
$fpath is a study in obfuscation. It is information that subtracts from
knowledge.
# Assume starting here with the default $fpath
zsh_default_functions=~/.zsh-default-functions.zwc
if ! zcompile -t $zsh_default_functions >&/dev/null
then
# File is missing or out of date. Rebuild it.
# Removes the file if any function cannot be compiled.
zcompile $zsh_default_functions $^fpath/*(N.:A)
fi
if [[ -f $zsh_default_functions ]]
then
fpath=( $zsh_default_functions )
autoload -w $zsh_default_functions
fi
Deep magic ...
Arigato sensei
Messages sorted by:
Reverse Date,
Date,
Thread,
Author