init-loader.el
is a loader of configuration files. init-loader.el
loads configuration files from specified directory. It enables you to
categorize your configurations and separate them into multiple files.
The original code is
here.
The current version of init-loader.el
is based on
tarao's fork version, which
have some issues fixed and some essential features added compared with
the original one.
You only have to call init-loader-load
with a directory where your
configuration files are located.
(require 'init-loader)
;; Load configuration files in '/path/to/init-directory'.
(init-loader-load "/path/to/init-directory")
;; If you omit arguments, then `init-loader-directory' is used
(init-loader-load)
Note that not all files in the directory are loaded. Each file is
examined that if it is a .el or .elc file and, it has a valid name
specified by init-loader-default-regexp
or it is a platform specific
configuration file.
By default, valid names of configuration files start with two digits. For example, the following file names are all valid:
- 00_util.el
- 01_ik-cmd.el
- 21_javascript.el
- 99_global-keys.el
Files are loaded in the lexicographical order. This helps you to resolve dependency of the configurations.
A platform specific configuration file has a prefix corresponds to the platform. The following is the list of prefixes and platform specific configuration files are loaded in the listed order after non-platform specific configuration files.
Platform | Subplatform | Prefix | Example |
---|---|---|---|
Windows | windows- |
windows-fonts.el | |
Meadow | meadow- |
meadow-commands.el | |
Mac OS X | Carbon Emacs | carbon-emacs- |
carbon-emacs-applescript.el |
Cocoa Emacs | cocoa-emacs- |
cocoa-emacs-plist.el | |
GNU/Linux | linux- |
linux-commands.el | |
*BSD | bsd- |
bsd-commands.el | |
All | Non-window system | nw- |
nw-key.el |
If init-loader-byte-compile
is non-nil, each configuration file is
byte-compiled when it is loaded. If you modify the .el file, then it
is recompiled next time it is loaded.
Loaded files and errors during the loading process are recorded. If
init-loader-show-log-after-init
is non-nil, the record is shown
after the overall loading process. You can do this manually by M-x init-loader-show-log
.
Function to load configuration files in INIT-DIR
.
Interactive command to show log messages.
Default directory of configuration files.
Show log message after initializing if this value is t
.
If this value is error-only
, log buffer is shown only
errors occured.
Byte-compile configuration files if this value is non-nil.
Abnormal hook run before byte-compiling a configuration file when
init-loader-byte-compile
is non-nil. Each function in the hook
takes one argument, which is the name of the configuration file to be
loaded.