I have a situation where I have a function that depends on other functions. So
(defun a ()
(something))
and
(defun b ()
(something-else))
are used by
(defun c ()
(something-calling (a) (b))
Not wanting to do a blanket load of everything -- and not really wanting to rewrite to include a
and b
in a cl-flet
block -- would I change c
to use eval
, or is there any trick to have c
autoload what it is dependent upon? I've seen autoload
, but I'm not sure if it's applicable here.
I guess I'd like to be able to talk to the elisp "live namespace" and tell it, "If you see this function called, go ahead and load/initialize these dependent functions/variables."
require
would be good, but what ifa
andb
are not in the same file? I want them to be anywhere. Could I do some sort of path or net location? Again, I don't want to always be doingrequire
on a whole "package" and I don't want to have to break down things to one function per file, either. Library of Babel allowed that, only very primitively. – 147pm Nov 24 '15 at 02:03a
is in filea-lib.el
andb
is in fileb-lib.el
. If you have no idea where they are then all you can do is punt. You either have the necessary libraries in yourload-path
or you tell Emacs to load them, one way or another. Even an autoload specifies which library defines a given function. – Drew Nov 24 '15 at 02:23require 'Package-A
. That seems clumsy and globby. I'd like a registry of functions and data where I can just go shopping and plug things (e.g. functions) together like lego blocks. BTW, I don't think I invented this idea. – 147pm Nov 27 '15 at 21:54(autoload...)
sexps to your code to ensure that the files it requires are loaded. – Drew Nov 27 '15 at 22:27