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,11 +3,10 @@
(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)
(defconst doom-default-font nil) (defconst doom-default-font nil)
(defconst doom-emacs-dir (! (expand-file-name "." user-emacs-directory))) (defconst doom-emacs-dir (! (expand-file-name "." user-emacs-directory)))
(defconst doom-core-dir (! (concat doom-emacs-dir "/core"))) (defconst doom-core-dir (! (concat doom-emacs-dir "/core")))
@ -45,36 +44,39 @@
(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"
(setq-default gc-cons-threshold 4388608 `(progn
gc-cons-percentage 0.4) (setq doom-default-theme ',default-theme
;; prematurely optimize for faster startup doom-terminal-theme ',term-theme
(let ((gc-cons-threshold 339430400) doom-default-font (font-spec :family ,(nth 0 font) :size ,(nth 1 font) :antialias ,(not (nth 2 font))))
(gc-cons-percentage 0.6) (setq-default gc-cons-threshold 4388608
file-name-handler-alist) gc-cons-percentage 0.4)
;; Scan various folders to populate the load-paths ;; prematurely optimize for faster startup
(setq load-path (let ((gc-cons-threshold 339430400)
(! (append (list doom-private-dir) (gc-cons-percentage 0.6)
(--subdirs doom-core-dir t) file-name-handler-alist)
(--subdirs doom-modules-dir t) ;; Scan various folders to populate the load-paths
(--subdirs doom-packages-dir) (setq load-path
(--subdirs (expand-file-name "../bootstrap" doom-packages-dir)) ',(append (list doom-private-dir)
doom--load-path)) (--subdirs doom-core-dir t)
custom-theme-load-path (--subdirs doom-modules-dir t)
(! (append (list (expand-file-name "themes/" doom-private-dir)) (--subdirs doom-packages-dir)
custom-theme-load-path))) (--subdirs (expand-file-name "../bootstrap" doom-packages-dir))
doom--load-path)
(load "~/.emacs.local.el" t t) custom-theme-load-path
(setq doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme) ',(append (list (expand-file-name "themes/" doom-private-dir))
doom-current-font doom-default-font) custom-theme-load-path))
(mapc 'require packages) (load "~/.emacs.local.el" t t)
(when (display-graphic-p) (setq doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme)
(require 'server) doom-current-font doom-default-font)
(unless (server-running-p) ,@(mapcar (lambda (pkg) `(require ',pkg)) packages)
(server-start))) (when (display-graphic-p)
;; Prevent any auto-displayed text + benchmarking (require 'server)
(advice-add 'display-startup-echo-area-message :override 'ignore) (unless (server-running-p)
(message ""))) (server-start)))
;; Prevent any auto-displayed text + benchmarking
(advice-add 'display-startup-echo-area-message :override 'ignore)
(message ""))))
;;; bootstrap.el ends here ;;; bootstrap.el ends here

119
init.el
View file

@ -30,72 +30,65 @@
(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
core-scratch ; a perdier scratch buffer
core-ui ; draw me like one of your French editors
core-evil ; come to the dark side, we have cookies
core-editor ; filling the editor-shaped hole in the emacs OS
core-company ; auto-completion, for the lazy typist
core-yasnippet ; snippets, for the lazier typist
core-autoinsert ; file templates, for the laziest typist
core-flycheck ; get tazed for every semicolon you forget
core-project ; for project navigation aficionados
core-vcs ; remember remember, that commit in November
core-helm ; a search engine for life and love
core-workgroups ; cure Emacs alzheimers + tab emulation
core-eval ; run code, run; debug too
core-popup ; taming sudden and inevitable windows
(doom `(core ; core/core.el ;;; Dev environments
module-cc ; C/C++/Obj-C madness
module-crystal ; ruby at the speed of c
module-csharp ; unity, .NET, and mono shenanigans
module-css ; #big-bang::before { content: ""; }
module-data ; config/data formats
module-db ; using emacs as a db browser/client
module-go ; the hipster dialect
module-haskell ; a language that's lazier than I am
module-java ; the poster child for carpal tunnel syndrome
module-js ; all(hope(abandon(ye(who(enter(here))))))
module-julia ; MATLAB, but fast
module-latex ; for writing papers in Emacs
module-elisp ; drowning in parentheses
module-lua ; one-based indices? one-based indices.
module-php ; making php less painful to work with
module-processing ; pretty prototypes
module-python ; beautiful is better than ugly
module-ruby ; 1.step do {|i| p "Ruby is #{i&1==0?'love':'life'}"}
module-rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
module-scala ; Java, but good
module-sh ; she sells Z-shells by the C XOR
module-swift ; I wanted emoji variables. I got them
module-text ; writing docs for people to ignore
module-web ; The end is always near </html>
,(cond (IS-MAC 'core-os-osx) ;;; Experimental
(IS-LINUX 'core-os-linux) ; module-eshell ; for inferior OSes *cough*windows
(IS-WINDOWS 'core-os-win32)) ; module-org ; for organized fearless leader
;; The heart of DOOM ;;; Extra libraries
core-scratch ; a perdier scratch buffer extra-demo ; allow me to demonstrate...
core-ui ; draw me like one of your French editors extra-tags ; if you liked it you should've generated a tag for it
core-evil ; come to the dark side, we have cookies extra-tmux ; close the rift between GUI & terminal
core-editor ; filling the editor-shaped hole in the emacs OS extra-write ; Emacs as a word processor
core-company ; auto-completion, for the lazy typist
core-yasnippet ; snippets, for the lazier typist
core-autoinsert ; file templates, for the laziest typist
core-flycheck ; get tazed for every semicolon you forget
core-project ; for project navigation aficionados
core-vcs ; remember remember, that commit in November
core-helm ; a search engine for life and love
core-workgroups ; cure Emacs alzheimers + tab emulation
core-eval ; run code, run; debug too
core-popup ; taming sudden and inevitable windows
;; Environments ;;; Personal
module-cc ; C/C++/Obj-C madness my-commands
module-crystal ; ruby at the speed of c my-bindings)
module-csharp ; unity, .NET, and mono shenanigans
module-css ; #big-bang::before { content: ""; }
module-data ; config/data formats
module-db ; using emacs as a db browser/client
module-go ; the hipster dialect
module-haskell ; a language that's lazier than I am
module-java ; the poster child for carpal tunnel syndrome
module-js ; all(hope(abandon(ye(who(enter(here))))))
module-julia ; MATLAB, but fast
module-latex ; for writing papers in Emacs
module-lisp ; drowning in parentheses
module-lua ; one-based indices? one-based indices.
module-php ; making php less painful to work with
module-processing ; pretty prototypes
module-python ; beautiful is better than ugly
module-ruby ; 1.step do {|i| p "Ruby is #{i&1==0?'love':'life'}"}
module-rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
module-scala ; Java, but good
module-sh ; she sells Z-shells by the C XOR
module-swift ; I wanted emoji variables. I got them
module-text ; writing docs for people to ignore
module-web ; The end is always near </html>
;; Experimental
;;module-eshell ; for inferior OSes *cough*windows
;;module-org ; for organized fearless leader
;; Extra libraries
extra-demo ; allow me to demonstrate...
extra-tags ; if you liked it you should've generated a tag for it
extra-tmux ; close the rift between GUI & terminal
extra-write ; Emacs as a word processor
;; Personal
my-commands
my-bindings
))