Load customizations directy during initialization time
Loading customizations in `db/run-init' may cause accidental overwrites of custom settings when loading variables changes and saves values of other customizable variables. For example, loading `custom-enabled-themes' may update `custom-safe-themes', and if this loading happens after initialization time, this update is directly written to custom.el via a call to `customize-push-and-save', overwriting all remaining, i.e. not loaded, custom settings. Loading custom settings during initialzation time prevents this behavior. Note that this change causes some packages to load during initialization time that previously had been loaded only afterwards.
This commit is contained in:
parent
fb5b2224fe
commit
96fd57bb90
16
README.org
16
README.org
|
@ -77,14 +77,14 @@ data (like customization) is outsourced into a separate directory named
|
|||
work nevertheless, even without these private files.
|
||||
|
||||
The main =init.el= file consists mostly of variable assignments, =use-package=
|
||||
declarations, and initializing the =package= subsystem. The main lifting is
|
||||
done by the =db/run-init= function, which is attached to the =after-init-hook=
|
||||
in =init.el=. This way, all necessary local hooks and autoloads are set up by
|
||||
=init.el=, and the =db/run-init= functions only activates a (minimal?)
|
||||
configurations needed for every session, including modes, keybindings, hydras,
|
||||
and global hooks. It also imports some environment variables and starts the
|
||||
server when running under windows. Any additional packages are only loaded when
|
||||
required.
|
||||
declarations, initializing the =package= subsystem, and loading customizations.
|
||||
The main lifting is done by the =db/run-init= function, which is attached to the
|
||||
=after-init-hook= in =init.el=. This way, all necessary local hooks and
|
||||
autoloads are set up by =init.el=, and the =db/run-init= functions only
|
||||
activates a (minimal?) configurations needed for every session, including
|
||||
modes, keybindings, hydras, and global hooks. It also imports some environment
|
||||
variables and starts the server when running under windows. Any additional
|
||||
packages are only loaded when required.
|
||||
|
||||
Lastly, ~db/run-init~ loads all files contained in ~db/after-init-load-files~,
|
||||
in that order.
|
||||
|
|
11
init.el
11
init.el
|
@ -66,11 +66,6 @@
|
|||
|
||||
(message "Running main initialization ...")
|
||||
|
||||
;; Load customizations
|
||||
|
||||
(when (file-exists-p custom-file)
|
||||
(load-file custom-file))
|
||||
|
||||
;; Activate modes (builtin)
|
||||
|
||||
(show-paren-mode 1)
|
||||
|
@ -2818,4 +2813,10 @@ With given ARG, display files in `db/important-document-path’."
|
|||
:diminish yas-minor-mode
|
||||
:config (yas-reload-all))
|
||||
|
||||
|
||||
;; * Load customizations
|
||||
|
||||
(when (file-exists-p custom-file)
|
||||
(load-file custom-file))
|
||||
|
||||
;;; init.el ends here
|
||||
|
|
Loading…
Reference in New Issue