Questions tagged [autoload]
53 questions
33
votes
3 answers
When should I use autoload instead of require?
From what I understand require is used to load large chunks of code (something like modules) although it can also load individual functions.
Autoload on the other side, only registers functions and defers the loading to execution time.
I've recently…

caisah
- 4,056
- 1
- 23
- 43
22
votes
2 answers
How can I improve startup time despite many packages?
TL;DR I have such a huge amount of packages that it's hurting my startup time. If you don't believe that could be the case, read on.
My Emacs startup time is quite small. I don't use use-package, I just set tons of hooks and autoloads so that…

GDP2
- 1,340
- 9
- 25
10
votes
3 answers
How to generate and activate autoloads for local packages?
It is clear that not all local/custom/personal packages should be officially released, and it would be silly to do so just to benefit from built-in package management support. I'm wondering how to generate and activate autoloads for local packages?…

Alexander Shukaev
- 1,125
- 10
- 22
8
votes
1 answer
Autoloads and variables
I understand what autoload does for functions (register file to load when
such function is called or its documentation string is retrieved). However,
it's not clear how to use autoload facility in conjunction with variables
and macros.
I have two…

Mark Karpov
- 4,893
- 1
- 24
- 53
6
votes
2 answers
How to lazy load init files to speedup Emacs startup?
My ~/.emacs.d/init.el file looks like this:
(package-initialize)
(require 'init-my-emacs-settings)
(require 'init-my-emacs-performance)
(require 'init-my-emacs-font)
(require 'init-my-emacs-color-theme)
(require 'init-my-emacs-appearance)
(require…

stardiviner
- 1,888
- 26
- 45
6
votes
1 answer
use-package :defer t and autoloads
My understanding is if that I use any of :commands, :bind, :bind*, :bind-keymap, :bind-keymap*, :mode, or :interpreter, then it will create a corresponding autoload and defer loading of the package until that autoload is triggered.
I'm confused…

Jorge Israel Peña
- 1,265
- 9
- 17
5
votes
3 answers
How to know which function triggered an autoload of a library
How can I monitor when Emacs loads a library because of an autoloaded function, and also know the name of that function?
EXAMPLE: I type M-x eval-buffer in a buffer where one of the functions uses setf (and I have not previously used this function…

lawlist
- 18,826
- 5
- 37
- 118
4
votes
1 answer
Autoloading defcustoms: good practice or not?
In my init file, I often find myself trying to set a customizable variable before the file (usually a mode of some sort) is loaded. This, of course, results in an error.
While this problem could be addressed through use-package and other means, it…

Tianxiang Xiong
- 3,848
- 16
- 27
4
votes
3 answers
loading tramp overrides tramp-remote-path customization back to default value
I have customized tramp-remote-path in my .emacs.d/init.el with
(custom-set-variables '(tramp-remote-path
(quote
(tramp-own-remote-path))))
but when tramp is loaded the value of tramp-remote-path is set to the default value. For example…

Daniel Mahler
- 267
- 1
- 12
4
votes
1 answer
use-package :defer t and add-hook
If I have something like:
(use-package X
:defer t
(add-hook 'some-mode 'package-x-function))
Will that work as expected given that I set :defer t and the package doesn't have any "built-in" autoloads and I'm not using any of the…

Jorge Israel Peña
- 1,265
- 9
- 17
3
votes
2 answers
Why is cl-loop autoloaded on byte-compilation?
This question is motivated by a question about the "void function" error on cl-loop in the init file.
The following test shows that (require 'cl-lib) is not needed for byte-compilation:
Assume you have a file ~/tmp/test.el with the following…

Tobias
- 32,569
- 1
- 34
- 75
3
votes
1 answer
How should I test that autoloads work properly with package.el?
I've added some autoloads to PACKAGE with the ;;;###autoload cookie and I've run M-x update-directory-autoloads which generated PACKAGE-autoloads.el. I have the following form in my init:
(package-initialize)
;; ...
;; some stuff that needs…

Sean Allred
- 6,861
- 16
- 85
3
votes
1 answer
are there conflicts between use-package and a package's autoloads?
Do I have to worry about a package's built-in autoloads somehow conflicting with those implicitly defined by use-package? For example if I do :commands some-cmd but the package already had an autoload created for some-cmd, will there be any…

Jorge Israel Peña
- 1,265
- 9
- 17
2
votes
1 answer
How to make defcustoms available before their file has been loaded?
I maintain an Elisp package that is split over many files, and each of the files has its own group of defcustoms in it, as a subgroup of the main package name.
I am unsure of how to make these defcustoms available before the specific file has been…

user27075
- 488
- 3
- 11
2
votes
2 answers
How to programatically detect if a unbound symbol is part of an autoloaded file and what file that is?
Given a variable or a function symbol not currently bound, what would be the variable that holds the auto-loading association I could use to search for the symbol and find out what file would get loaded when it is invoked?

PRouleau
- 744
- 3
- 10