Perdify init.el s'more; macro-ify `doom'

This commit is contained in:
Henrik Lissner 2016-05-22 22:08:37 -04:00
parent ea685bf07c
commit c160f42552
2 changed files with 90 additions and 95 deletions

View file

@ -3,7 +3,6 @@
(defalias '! 'eval-when-compile) (defalias '! 'eval-when-compile)
;; For benchmarking ;; For benchmarking
(defconst emacs-start-time (current-time)) (defconst emacs-start-time (current-time))
(defconst emacs-end-time nil)
;; Global constants ;; Global constants
(defconst doom-default-theme 'wombat) (defconst doom-default-theme 'wombat)
(defconst doom-terminal-theme 'wombat) (defconst doom-terminal-theme 'wombat)
@ -45,8 +44,12 @@
(defvar doom-current-theme) (defvar doom-current-theme)
(defvar doom-current-font) (defvar doom-current-font)
(defun doom (packages) (defmacro doom (_ default-theme _ term-theme _ font &rest packages)
"Bootstrap DOOM emacs and initialize PACKAGES" "Bootstrap DOOM emacs and initialize PACKAGES"
`(progn
(setq doom-default-theme ',default-theme
doom-terminal-theme ',term-theme
doom-default-font (font-spec :family ,(nth 0 font) :size ,(nth 1 font) :antialias ,(not (nth 2 font))))
(setq-default gc-cons-threshold 4388608 (setq-default gc-cons-threshold 4388608
gc-cons-percentage 0.4) gc-cons-percentage 0.4)
;; prematurely optimize for faster startup ;; prematurely optimize for faster startup
@ -55,26 +58,25 @@
file-name-handler-alist) file-name-handler-alist)
;; Scan various folders to populate the load-paths ;; Scan various folders to populate the load-paths
(setq load-path (setq load-path
(! (append (list doom-private-dir) ',(append (list doom-private-dir)
(--subdirs doom-core-dir t) (--subdirs doom-core-dir t)
(--subdirs doom-modules-dir t) (--subdirs doom-modules-dir t)
(--subdirs doom-packages-dir) (--subdirs doom-packages-dir)
(--subdirs (expand-file-name "../bootstrap" doom-packages-dir)) (--subdirs (expand-file-name "../bootstrap" doom-packages-dir))
doom--load-path)) doom--load-path)
custom-theme-load-path custom-theme-load-path
(! (append (list (expand-file-name "themes/" doom-private-dir)) ',(append (list (expand-file-name "themes/" doom-private-dir))
custom-theme-load-path))) custom-theme-load-path))
(load "~/.emacs.local.el" t t) (load "~/.emacs.local.el" t t)
(setq doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme) (setq doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme)
doom-current-font doom-default-font) doom-current-font doom-default-font)
(mapc 'require packages) ,@(mapcar (lambda (pkg) `(require ',pkg)) packages)
(when (display-graphic-p) (when (display-graphic-p)
(require 'server) (require 'server)
(unless (server-running-p) (unless (server-running-p)
(server-start))) (server-start)))
;; Prevent any auto-displayed text + benchmarking ;; Prevent any auto-displayed text + benchmarking
(advice-add 'display-startup-echo-area-message :override 'ignore) (advice-add 'display-startup-echo-area-message :override 'ignore)
(message ""))) (message ""))))
;;; bootstrap.el ends here ;;; bootstrap.el ends here

37
init.el
View file

@ -30,20 +30,13 @@
(load (concat user-emacs-directory "bootstrap.el")) (load (concat user-emacs-directory "bootstrap.el"))
(defconst doom-default-theme 'doom-one) (doom :default-theme doom-one
(defconst doom-terminal-theme 'doom-dark) :terminal-theme doom-dark
(defconst doom-default-font (font-spec :family "Fira Mono" :size 12)) :default-font ("Fira Mono" 12)
(defconst doom-leader "," "Prefix for <leader> bindings") ;;; The heart of DOOM
(defconst doom-localleader "\\" "Prefix for <localleader> bindings") core ; core/core.el
core-os ; os-specific config
(doom `(core ; core/core.el
,(cond (IS-MAC 'core-os-osx)
(IS-LINUX 'core-os-linux)
(IS-WINDOWS 'core-os-win32))
;; The heart of DOOM
core-scratch ; a perdier scratch buffer core-scratch ; a perdier scratch buffer
core-ui ; draw me like one of your French editors core-ui ; draw me like one of your French editors
core-evil ; come to the dark side, we have cookies core-evil ; come to the dark side, we have cookies
@ -59,7 +52,7 @@
core-eval ; run code, run; debug too core-eval ; run code, run; debug too
core-popup ; taming sudden and inevitable windows core-popup ; taming sudden and inevitable windows
;; Environments ;;; Dev environments
module-cc ; C/C++/Obj-C madness module-cc ; C/C++/Obj-C madness
module-crystal ; ruby at the speed of c module-crystal ; ruby at the speed of c
module-csharp ; unity, .NET, and mono shenanigans module-csharp ; unity, .NET, and mono shenanigans
@ -72,7 +65,7 @@
module-js ; all(hope(abandon(ye(who(enter(here)))))) module-js ; all(hope(abandon(ye(who(enter(here))))))
module-julia ; MATLAB, but fast module-julia ; MATLAB, but fast
module-latex ; for writing papers in Emacs module-latex ; for writing papers in Emacs
module-lisp ; drowning in parentheses module-elisp ; drowning in parentheses
module-lua ; one-based indices? one-based indices. module-lua ; one-based indices? one-based indices.
module-php ; making php less painful to work with module-php ; making php less painful to work with
module-processing ; pretty prototypes module-processing ; pretty prototypes
@ -85,17 +78,17 @@
module-text ; writing docs for people to ignore module-text ; writing docs for people to ignore
module-web ; The end is always near </html> module-web ; The end is always near </html>
;; Experimental ;;; Experimental
;;module-eshell ; for inferior OSes *cough*windows ; module-eshell ; for inferior OSes *cough*windows
;;module-org ; for organized fearless leader ; module-org ; for organized fearless leader
;; Extra libraries ;;; Extra libraries
extra-demo ; allow me to demonstrate... extra-demo ; allow me to demonstrate...
extra-tags ; if you liked it you should've generated a tag for it extra-tags ; if you liked it you should've generated a tag for it
extra-tmux ; close the rift between GUI & terminal extra-tmux ; close the rift between GUI & terminal
extra-write ; Emacs as a word processor extra-write ; Emacs as a word processor
;; Personal ;;; Personal
my-commands my-commands
my-bindings my-bindings)
))