all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Basic question about autoload function
Date: Wed, 06 Dec 2017 19:14:33 +0000	[thread overview]
Message-ID: <CAFyQvY3=TqWLCnQDAsWXp0zyw1xMhCmRrmGVYUy0n0d8r8rS_Q@mail.gmail.com> (raw)
In-Reply-To: <8199d375-ba83-44b0-b30f-5503fab7f4cf@default>

On Wed, Dec 6, 2017 at 2:04 PM Drew Adams <drew.adams@oracle.com> 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
those.

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

Thanks.

> 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	other threads:[~2017-12-06 19:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 18:55 Basic question about autoload function Kaushal Modi
2017-12-06 19:04 ` Drew Adams
2017-12-06 19:14   ` Kaushal Modi [this message]
2017-12-08 13:39     ` Michael Heerdegen
2017-12-08 18:59       ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY3=TqWLCnQDAsWXp0zyw1xMhCmRrmGVYUy0n0d8r8rS_Q@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.