Open rye opened 4 years ago
Actually, no, I don't know if I can do this by just adding calls to require
everyhere.
When I do that, the startup time goes up from 2 seconds to nearly 5 seconds (on my machine, which is not the most speedy). This is because the interpreter has to load the entire feature (i.e. the entire package) before it continues, whereas with the existing system, autoloads ensure that the required files are loaded before the symbols are actually used.
I can resolve the config compilation warnings, at least, by adding (eval-when-compile (require '<package>))
lines to the files. Sometimes, autoloads aren't fully generated, so we have to add custom (autoload)
lines. (This usually happens when packages are grouped together like magit
and magit-popup
, where magit
depends on symbols from magit-popup
.) On my working branch, I've only had to do this once or twice for a few odd packages.
A style question, then: do we want to have everything loaded up and ready to go at startup, or would we rather have a slight overhead at the time of buffer creation for features that haven't yet been loaded? (For example, when loading your first sh-mode
buffer, you have to load and valuate the customizations for sh-mode
which requires autoloading.) Personally I really like just loading everything up and being ready after startup.
On startup (after applying #136 to fix config compilation), I get the following warnings printed to
*config-compilation*
:I think it's worth investigating the "assignment to free variable" errors at least, and I'm going to do some poking around to see if there are any other things we should do. Here's a checklist containing the warnings and errors.
package/verification.el:1:1:Warning: cl package required at runtime
package/verification.el:12:41:Warning: reference to free variable ‘kotct/dependency-list’
package/verification.el:26:1:Warning: the function ‘kotct/packup-install-dependencies’ is not known to be defined.
package/packup.el:9:1:Warning: cl package required at runtime
package/packup.el:55:26:Warning: reference to free variable ‘kotct/package-ordered-archives’
Eager macro-expansion failure: (void-function kotct/check-dependency-list)
Eager macro-expansion failure: (void-function kotct/check-dependency-list)
package/git-update.el:6:1:Error: Symbol’s function definition is void: kotct/check-dependency-list
file/recentf-c.el:6:1:Warning: cl package required at runtime
visual/line-numbers-c.el:10:11:Warning: assignment to free variable ‘linum-format’
visual/line-numbers-c.el:18:19:Warning: reference to free variable ‘linum-disabled-modes-list’
visual/line-numbers-c.el:18:19:Warning: assignment to free variable ‘linum-disabled-modes-list’
behavior/completion-c.el:11:7:Warning: assignment to free variable ‘ido-enable-flex-matching’
behavior/completion-c.el:37:11:Warning: assignment to free variable ‘ido-vertical-show-count’
behavior/completion-c.el:38:11:Warning: assignment to free variable ‘ido-vertical-define-keys’
behavior/completion-c.el:52:7:Warning: assignment to free variable ‘smex-save-file’
behavior/text.el:7:1:Warning: cl package required at runtime
behavior/text.el:14:7:Warning: assignment to free variable ‘avy-zap-function’
behavior/text.el:51:1:Warning: the function ‘er/contract-region’ is not known to be defined.
code/editorconfig-c.el:25:33:Warning: reference to free variable ‘editorconfig-exec-path’
code/magit-c.el:13:1:Warning: the following functions are not known to be defined: magit-define-popup-option, magit-read-gpg-secret-key
code/indentation.el:3:7:Warning: assignment to free variable ‘global-tab-width’
code/indentation.el:33:25:Warning: reference to free variable ‘global-tab-width’
code/indentation.el:34:17:Warning: assignment to free variable ‘smie-indent-basic’
code/languages/tex.el:4:49:Warning: reference to free variable ‘ispell-program-name’
code/languages/web-c.el:19:7:Warning: assignment to free variable ‘web-mode-enable-control-block-indentation’
code/languages/web-c.el:20:7:Warning: assignment to free variable ‘web-mode-script-padding’
code/languages/sh.el:4:17:Warning: assignment to free variable ‘sh-basic-offset’
code/languages/sh.el:5:17:Warning: assignment to free variable ‘sh-indentation’
code/languages/sh.el:11:7:Warning: assignment to free variable ‘sh-indent-for-case-label’
code/languages/sh.el:14:7:Warning: assignment to free variable ‘sh-indent-for-case-alt’
Warning: Eager macro-expansion skipped due to cycle: … => (load "smart-tabs-mode.el") => (macroexpand-all …) => (macroexpand (smart-tabs-create-advice-list …)) => (load "smart-tabs-mode.el")
code/languages/rust.el:17:7:Warning: assignment to free variable ‘rust-indent-where-clause’
code/languages/ruby.el:16:7:Warning: assignment to free variable ‘ruby-indent-tabs-mode’
code/languages/ruby.el:19:7:Warning: assignment to free variable ‘ruby-use-smie’
code/languages/c.el:4:7:Warning: assignment to free variable ‘c-default-style’
code/languages/c.el:7:17:Warning: assignment to free variable ‘c-basic-offset’
user/user-config-system.el:36:51:Warning: reference to free variable ‘frame’
user/user-config-system.el:116:1:Warning: the following functions are not known to be defined: kotct/check-dependency-list, kotct/user-fetch-config
(Some of these may exist only in my configuration; I'll prune down the list as I go through it.)