Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8083043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:19:51+00:00 2026-06-05T17:19:51+00:00

In ELisp, you can skip the evaluation of a definition with the autoload cookie.

  • 0

In ELisp, you can skip the evaluation of a definition with the autoload cookie. The definition is evaluated only once it’s used.

;; File foo.el

;;;###autoload
(defun foo ()
  "Doc"
  42)

(defun bar ()
  "Doc"
  43)

So, if I understand correctly the autoload functionnality is a hack to load file faster. But when I load foo.el, in order to skip the definition of foo the interpreter still has to read the whole form. I don’t understand why it’s faster.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:19:53+00:00Added an answer on June 5, 2026 at 5:19 pm

    The simplest way to load the content of the file foo.el is to do a load.
    However, this is costly because you have to read the whole file.

    With autoload you are allowed to tell emacs: “function foo is defined in file foo.el“.
    This way emacs does not read the file and you do not pay the loading price. When you use the function foo for the first time, emacs will find the definition for you by reading foo.el.

    The ;;;###autoload comment in your file is not doing anything for autoload by itself.
    You need to use a program that will grab all of these definitions and put them in a file foo-autoloads.el (or any other name).
    For each function it will put a line telling emacs which file contains it.
    Then in your .emacs you will load foo-autoloads.el instead of foo.el.
    foo.el will be read by emacs the first time you use function foo.

    Note: require can also be used instead of load in the explanation above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I fix the simple macro foo in (elisp)Eval During Expansion ? None
When I have elisp function (defun hello (param) ... ) how can I run
When programmin in Elisp, how can I visit a new file in a new
What problem can happen if the goto-line function is used in a non-interactive elisp
I'm writing an elisp module that requires an external text file. For the curious,
I am looking to include a reference to a non-elisp file (a small Python
I need an emacs built-in function or elisp function that can take me to
Using elisp (not interactive key-chords), how can I run a command in emacs terminal
Is it any analogies to Scheme define-syntax in ELisp? In define-syntax I can specify
Is there an Elisp command which can return Mac, Windows, linux, etc??

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.