[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic question about autoload function

From: Kaushal Modi
Subject: Re: Basic question about autoload function
Date: Wed, 06 Dec 2017 19:14:33 +0000

On Wed, Dec 6, 2017 at 2:04 PM Drew Adams <> wrote:

> > I have recently realized that (autoload #'foo-fn "bar-pkg")
> > works even if foo-fn is *not* defined inside bar-pkg.
> What do you mean by "works"?

By "works", I meant that bar-pkg got loaded when I called foo-fn. Sorry, I
myself hate the "works" and "does not work" phrases and I ended up using

All that does is cause file bar-pkg.el[c] to be loaded
> whenever someone or something tries to invoke/use function,
> macro, or keymap `foo-fn'.  (But it does nothing if `foo-fn'
> is a function already defined.)
> Yes, nothing implies that `foo-fn' is defined in bar-pkg.el.


> The documentation also doesn't say that it has to be that way.
> What doesn't have to be what way?

I meant to say that the documentation does not imply that the FUNCTION has
to be defined inside FILE. I was wondering if that was intentional i.e.
FUNCTION can or cannot be defined inside FILE.

> So I was just pleasantly surprised that that did the right thing.
> The right thing being ___?  I guess you wanted Emacs to
> load that file when that function is invoked?

Yes, bar-pkg got loaded even when I called foo-fn (where foo-fn was defined
outside bar-pkg).. no errors, nothing.. it just worked as I thought.

Kaushal Modi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]