zsh-workers
 help / color / mirror / code / Atom feed
* Modules can be built outside Zsh; custom version of autoload builtin
@ 2017-02-01 17:48 Sebastian Gniazdowski
  0 siblings, 0 replies; only message in thread
From: Sebastian Gniazdowski @ 2017-02-01 17:48 UTC (permalink / raw)
  To: zsh-workers

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@fastmail.com


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-01 17:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-01 17:48 Modules can be built outside Zsh; custom version of autoload builtin Sebastian Gniazdowski

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).