2015-06-06 06:40:33 -04:00
|
|
|
;;; core.el --- The heart of the beast
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
;;; Naming conventions:
|
2015-06-04 18:23:21 -04:00
|
|
|
;;
|
2017-01-16 23:15:48 -05:00
|
|
|
;; doom-... A public variable or function (non-interactive use)
|
|
|
|
;; doom--... A private variable, function (non-interactive use) or macro
|
|
|
|
;; doom/... An interactive function
|
|
|
|
;; doom:... An evil operator, motion or command
|
|
|
|
;; doom|... A hook
|
|
|
|
;; doom*... An advising function
|
|
|
|
;; ...! Macro, shortcut alias or defsubst
|
2017-02-08 02:02:51 -05:00
|
|
|
;; @... A generator macro for keybinds
|
2017-01-16 23:15:48 -05:00
|
|
|
;; +... Any of the above, but part of a module, e.g. +emacs-lisp|init-hook
|
2015-06-04 18:23:21 -04:00
|
|
|
;;
|
2017-02-08 02:02:51 -05:00
|
|
|
;; Autoloaded functions are in core/autoload/*.el and modules/*/*/autoload.el or
|
|
|
|
;; modules/*/*/autoload/*.el.
|
2015-06-04 18:23:21 -04:00
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
(when (version< emacs-version "25.1")
|
|
|
|
(error "DOOM Emacs no longer supports Emacs <25.1! Time to upgrade!"))
|
2016-10-02 23:25:08 +02:00
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
;;;
|
|
|
|
(defvar doom-version "2.0.0"
|
2016-10-05 12:48:12 +02:00
|
|
|
"Current version of DOOM emacs")
|
|
|
|
|
2017-02-04 02:54:37 -05:00
|
|
|
(defvar doom-debug-mode (or (getenv "DEBUG") init-file-debug)
|
2017-02-03 08:00:38 -05:00
|
|
|
"If non-nil, all doom functions will be verbose. Set DEBUG=1 in the command
|
|
|
|
line or use --debug-init to enable this.")
|
2017-01-31 04:31:14 -05:00
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
(defvar doom-emacs-dir user-emacs-directory
|
2016-10-02 23:25:08 +02:00
|
|
|
"The path to this emacs.d directory")
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
(defvar doom-core-dir (concat doom-emacs-dir "core/")
|
2016-10-02 23:25:08 +02:00
|
|
|
"Where essential files are stored")
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
(defvar doom-modules-dir (concat doom-emacs-dir "modules/")
|
2016-10-02 23:25:08 +02:00
|
|
|
"Where configuration modules are stored")
|
|
|
|
|
2017-01-31 18:58:56 -05:00
|
|
|
(defvar doom-local-dir (concat doom-emacs-dir ".local/")
|
|
|
|
"Untracked directory for local Emacs files, including the cache
|
|
|
|
(`doom-cache-dir'), packages (`doom-packages-dir') and autoloads file.")
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-01-31 18:58:56 -05:00
|
|
|
(defvar doom-cache-dir
|
|
|
|
(concat doom-local-dir "cache/" (system-name) "/")
|
|
|
|
"Hostname-based directory for temporary files.")
|
2016-10-02 23:25:08 +02:00
|
|
|
|
2017-01-31 18:58:56 -05:00
|
|
|
(defvar doom-packages-dir
|
|
|
|
(concat doom-local-dir "packages/")
|
|
|
|
"Where package.el and quelpa plugins (and their caches) are kept.")
|
2016-05-23 06:26:28 -04:00
|
|
|
|
2017-02-06 01:25:48 -05:00
|
|
|
(defvar doom-autoload-file
|
|
|
|
(concat doom-local-dir "autoloads.el")
|
|
|
|
"Location of the autoloads.el, which is generated by `doom/refresh-autoloads'
|
|
|
|
and `doom-initialize-autoloads'.")
|
|
|
|
|
2017-01-31 18:59:14 -05:00
|
|
|
(defconst IS-MAC (eq system-type 'darwin))
|
|
|
|
(defconst IS-LINUX (eq system-type 'gnu/linux))
|
|
|
|
|
2016-05-26 18:51:39 -04:00
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
;;;
|
2017-01-31 18:59:58 -05:00
|
|
|
;; UTF-8 as the default coding system
|
2016-09-23 16:13:49 +02:00
|
|
|
(set-charset-priority 'unicode) ; pretty
|
|
|
|
(prefer-coding-system 'utf-8) ; pretty
|
2016-06-06 23:53:49 -04:00
|
|
|
(set-terminal-coding-system 'utf-8) ; pretty
|
2017-01-31 18:59:58 -05:00
|
|
|
(set-keyboard-coding-system 'utf-8) ; pretty
|
|
|
|
(set-selection-coding-system 'utf-8) ; perdy
|
|
|
|
(setq locale-coding-system 'utf-8) ; please
|
|
|
|
(setq-default buffer-file-coding-system 'utf-8) ; with sugar on top
|
2017-01-16 23:15:48 -05:00
|
|
|
|
|
|
|
;; Configuration
|
|
|
|
(setq ad-redefinition-accept 'accept ; silence advised function warnings
|
|
|
|
apropos-do-all t ; make `apropos' more useful
|
2017-01-31 18:59:58 -05:00
|
|
|
compilation-always-kill t ; kill compilation process before starting another
|
|
|
|
compilation-ask-about-save nil ; save all buffers on `compile'
|
2017-01-16 23:15:48 -05:00
|
|
|
compilation-scroll-output t
|
2016-05-28 21:51:21 -04:00
|
|
|
confirm-nonexistent-file-or-buffer t
|
2017-01-16 23:15:48 -05:00
|
|
|
enable-recursive-minibuffers nil
|
2017-01-31 18:59:58 -05:00
|
|
|
idle-update-delay 1 ; update ui less often
|
|
|
|
;; keep the point out of the minibuffer
|
2017-01-16 23:15:48 -05:00
|
|
|
minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
2017-01-31 18:59:58 -05:00
|
|
|
;; History & backup settings
|
|
|
|
auto-save-default nil
|
|
|
|
auto-save-list-file-name (concat doom-cache-dir "/autosave")
|
|
|
|
backup-directory-alist (list (cons ".*" (concat doom-cache-dir "/backup/")))
|
2017-01-16 23:15:48 -05:00
|
|
|
create-lockfiles nil
|
|
|
|
history-length 1000
|
|
|
|
make-backup-files nil
|
|
|
|
vc-make-backup-files nil)
|
|
|
|
|
2017-02-06 01:25:48 -05:00
|
|
|
;; be quiet at startup
|
|
|
|
(advice-add 'display-startup-echo-area-message :override 'ignore)
|
|
|
|
(setq inhibit-startup-message t
|
|
|
|
inhibit-startup-echo-area-message user-login-name)
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
|
|
|
;;;
|
2016-05-19 03:17:59 -04:00
|
|
|
;; Automatic minor modes
|
2016-05-20 22:37:30 -04:00
|
|
|
(defvar doom-auto-minor-mode-alist '()
|
2017-01-16 23:15:48 -05:00
|
|
|
"Alist mapping filename patterns to corresponding minor mode functions, like
|
2016-05-19 03:17:59 -04:00
|
|
|
`auto-mode-alist'. All elements of this alist are checked, meaning you can
|
|
|
|
enable multiple minor modes for the same regexp.")
|
|
|
|
|
2016-05-20 22:37:30 -04:00
|
|
|
(defun doom|enable-minor-mode-maybe ()
|
|
|
|
"Check file name against `doom-auto-minor-mode-alist'."
|
2016-05-19 03:17:59 -04:00
|
|
|
(when buffer-file-name
|
|
|
|
(let ((name buffer-file-name)
|
|
|
|
(remote-id (file-remote-p buffer-file-name))
|
2016-05-20 22:37:30 -04:00
|
|
|
(alist doom-auto-minor-mode-alist))
|
2016-05-19 03:17:59 -04:00
|
|
|
;; Remove backup-suffixes from file name.
|
|
|
|
(setq name (file-name-sans-versions name))
|
|
|
|
;; Remove remote file name identification.
|
|
|
|
(when (and (stringp remote-id)
|
|
|
|
(string-match-p (regexp-quote remote-id) name))
|
|
|
|
(setq name (substring name (match-end 0))))
|
|
|
|
(while (and alist (caar alist) (cdar alist))
|
|
|
|
(if (string-match (caar alist) name)
|
|
|
|
(funcall (cdar alist) 1))
|
|
|
|
(setq alist (cdr alist))))))
|
|
|
|
|
2016-05-20 22:37:30 -04:00
|
|
|
(add-hook 'find-file-hook 'doom|enable-minor-mode-maybe)
|
2016-05-19 03:17:59 -04:00
|
|
|
|
2016-10-02 23:21:47 +02:00
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
;;;
|
|
|
|
;; Bootstrap
|
|
|
|
(setq gc-cons-threshold 339430400
|
|
|
|
gc-cons-percentage 0.6)
|
|
|
|
|
|
|
|
(let (file-name-handler-list)
|
|
|
|
(eval-and-compile
|
2017-02-03 07:58:16 -05:00
|
|
|
(require 'core-packages (concat doom-core-dir "core-packages")))
|
2017-01-16 23:15:48 -05:00
|
|
|
(eval-when-compile
|
2017-01-31 04:31:14 -05:00
|
|
|
(doom-initialize))
|
|
|
|
(setq load-path (eval-when-compile load-path))
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-02-03 07:58:16 -05:00
|
|
|
;;; Let 'er rip
|
|
|
|
(require 'core-lib)
|
2017-02-08 02:02:51 -05:00
|
|
|
(doom-initialize-autoloads)
|
2017-02-03 07:58:16 -05:00
|
|
|
(unless noninteractive
|
2017-02-04 21:07:54 -05:00
|
|
|
(require 'core-ui) ; draw me like one of your French editors
|
|
|
|
(require 'core-popups) ; taming sudden yet inevitable windows
|
|
|
|
(require 'core-editor) ; baseline configuration for text editing
|
2017-02-08 02:02:51 -05:00
|
|
|
(require 'core-projects))) ; making Emacs project-aware
|
2017-01-31 18:47:59 -05:00
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
(provide 'core)
|
|
|
|
;;; core.el ends here
|