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

  • Home
  • SEARCH
  • 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 5953289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:48:14+00:00 2026-05-22T17:48:14+00:00

I use the following structure in my emacs config: For each programming mode I

  • 0

I use the following structure in my emacs config: For each programming mode I use, I maintain configuration in a file called programming-mode-config.el. (So python configuration will go into python-mode-config.el etc).

Earlier, I used to require each of these files in my init.el. The drawback of this approach was that my start-up time was huge. So this weekend, I sat down and converted all the requires into autoloads. Now my init file looks like this:

(autoload 'python-mode "python-mode-config" "Load python config" t)

Thus python config will not be loaded until I open a python file. This helped bring down my start-up time to about 1 second, but it doesn’t work properly in all cases. For example,

(autoload 'erc "erc-mode-config" "Load configuration for ERC" t)

does not load my erc tweaks at all. Looking at the autoload documentation, it states that:

Define FUNCTION to autoload from FILE.
...
If FUNCTION is already defined other than as an autoload,
this does nothing and returns nil.

So I’m guessing that the erc config is not loaded because ERC comes ‘in-built’ with emacs whereas python-mode is a plugin I use. Is there any way I can get my erc configuration to load only when I actually use erc? The only other alternative I see is using eval-after-load, but it would be rather painful to put every tiny bit of my customization into an eval-after-load.

I’m afraid it might also be that I haven’t grokked autoloads properly. Any help would be appreciated.

  • 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-05-22T17:48:15+00:00Added an answer on May 22, 2026 at 5:48 pm

    autoload is intended to be used to load functions from a certain file, not to load additional functionality – which is what it looks like you’re trying to do.

    Use eval-after-load instead:

    (eval-after-load "erc" '(load "erc-mode-config"))
    

    That tells Emacs to load the erc-mode-config library after the "erc" file has been loaded – which is what you want. You could also use '(require 'erc-mode-config) if you have a provide statement inside of it.

    The correct use of autoload is to load the actual file that contains the symbol. So, by having

    (autoload 'erc "erc-mode-config" "Load configuration for ERC" t)
    

    You were telling Emacs to find the function erc by loading the "erc-mode-config" library, which isn’t where the erc function is defined. Also, the docstring is for the function in question, so the autoload statement above makes the help string for erc be "Load configuration for ERC" – which is also incorrect.

    I’m guessing your first autoload example works because you have a (require 'python) statement in your config file… but that’s just a guess.

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

Sidebar

Related Questions

Suppose you use the following structure: var Args = new Object(); Args.Age = '10';
If possible I would like to use the following structure for a command however
I use the following structure to set out my objects/classes in JavaScript: SelectUser =
Is there a way to define the following structure in a DataContext/DBML file? public
I use the following code to create a zip file: var files = Directory.GetFiles(targetPath);
I have a question. I use jquery superfish menu with the following structure <div
Assume you have a CSV file with the following structure LINE1: ID,Description,Value LINE2: 1,Product1,2
I use the following structure Dictionary<string, List<object>> I want to get the first element
I am transforming XML into HTML using XSLT. I have the following XML structure:
I use the following to get a list of project files that need to

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.