Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Modules can be built outside Zsh; custom version of autoload builtin



Hello
1/ Turned out that it's easy to build Zsh modules away from complete
source. Here is a minimum build setup:

https://github.com/psprint/zplugin/tree/6a4ba014eb167cbc97353f0a59e63f62bd6442bc/zmodules

Tested this on OS X. I can load module built with Zsh 5.3.1 features
even on Apple-provided 5.0.8. It's only that lazy binding will fail, if
I call non-existent (in 5.0.8) function. So, plugin creators can
actually provide binary parts, what I'm intending to do too, in Zplugin.


2/ I needed the following to work (for Zplugin):

# echo $ZSH_VERSION
5.3.1-dev-0
# mkdir ~/myfunctions
# mv /usr/local/share/zsh/5.3.1-dev-0/functions/calendar* ~/myfunctions
# autoload ~/myfunctions/calendar
# calendar
calendar:36: calendar_scandate: function definition file not found


Turned out that it's possible to overwrite bin_autoload pointer with own
function, provided in module. Patch that makes the above work:

https://github.com/psprint/zplugin/commit/bdf28d4c17d0d7e8ab86db8e3f58b15c85bf8560

I did there:

#define PM_ABSPATH_USED       (1<<12) /* (function): loaded using
absolute path (shared with PM_EXPORTED) */

I think it's good idea to add also in upstream Zsh, to detect
absolute-path origin of function.

-- 
  Sebastian Gniazdowski
  psprint2@xxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author