[Fix #451] Add the ability to preload personal code

This commit is contained in:
Bozhidar Batsov 2013-12-06 17:34:06 +02:00
parent 3cdb7f32ad
commit 4ca22fbf1c
3 changed files with 17 additions and 0 deletions

View file

@ -443,6 +443,12 @@ If you require just a single package you can also use:
(prelude-require-package 'some-package)
```
#### Preloading personal config
Sometimes you might want to load code before Prelude has started loading. Prelude will automatically preload all
Emacs Lisp files in your `personal/preload` directory. Note that at this point you can't using anything from
Prelude, except a few variables like `prelude-dir`, etc (since nothing is yet loaded).
#### Disabling whitespace-mode
Although `whitespace-mode` is awesome some people might find it too

11
init.el
View file

@ -53,6 +53,8 @@
Users of Emacs Prelude are encouraged to keep their personal configuration
changes in this directory. All Emacs Lisp files there are loaded automatically
by Prelude.")
(defvar prelude-personal-preload-dir (expand-file-name "preload" prelude-personal-dir)
"This directory is for your personal configuration, that you want loaded before Prelude.")
(defvar prelude-vendor-dir (expand-file-name "vendor" prelude-dir)
"This directory houses packages that are not yet available in ELPA (or MELPA).")
(defvar prelude-savefile-dir (expand-file-name "savefile" prelude-dir)
@ -83,6 +85,13 @@ by Prelude.")
;; each 50MB of allocated data (the default is on every 0.76MB)
(setq gc-cons-threshold 50000000)
;; preload the personal settings from `prelude-personal-preload-dir'
(when (file-exists-p prelude-personal-preload-dir)
(message "Loading personal configuration files in %s..." prelude-personal-preload-dir)
(mapc 'load (directory-files prelude-personal-preload-dir 't "^[^#].*el$")))
(message "Loading Prelude's core...")
;; the core stuff
(require 'prelude-packages)
(require 'prelude-ui)
@ -95,6 +104,8 @@ by Prelude.")
(when (eq system-type 'darwin)
(require 'prelude-osx))
(message "Loading Prelude's modules...")
;; the modules
(when (file-exists-p prelude-modules-file)
(load prelude-modules-file))

View file