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)
;; For benchmarking
(defconst emacs-start-time (current-time))
(defconst emacs-end-time nil)
;; Global constants
(defconst doom-default-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-core-dir (! (concat doom-emacs-dir "/core")))
@ -45,36 +44,39 @@
(defvar doom-current-theme)
(defvar doom-current-font)
(defun doom (packages)
(defmacro doom (_ default-theme _ term-theme _ font &rest packages)
"Bootstrap DOOM emacs and initialize PACKAGES"
(setq-default gc-cons-threshold 4388608
gc-cons-percentage 0.4)
;; prematurely optimize for faster startup
(let ((gc-cons-threshold 339430400)
(gc-cons-percentage 0.6)
file-name-handler-alist)
;; Scan various folders to populate the load-paths
(setq load-path
(! (append (list doom-private-dir)
(--subdirs doom-core-dir t)
(--subdirs doom-modules-dir t)
(--subdirs doom-packages-dir)
(--subdirs (expand-file-name "../bootstrap" doom-packages-dir))
doom--load-path))
custom-theme-load-path
(! (append (list (expand-file-name "themes/" doom-private-dir))
custom-theme-load-path)))
(load "~/.emacs.local.el" t t)
(setq doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme)
doom-current-font doom-default-font)
(mapc 'require packages)
(when (display-graphic-p)
(require 'server)
(unless (server-running-p)
(server-start)))
;; Prevent any auto-displayed text + benchmarking
(advice-add 'display-startup-echo-area-message :override 'ignore)
(message "")))
`(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
gc-cons-percentage 0.4)
;; prematurely optimize for faster startup
(let ((gc-cons-threshold 339430400)
(gc-cons-percentage 0.6)
file-name-handler-alist)
;; Scan various folders to populate the load-paths
(setq load-path
',(append (list doom-private-dir)
(--subdirs doom-core-dir t)
(--subdirs doom-modules-dir t)
(--subdirs doom-packages-dir)
(--subdirs (expand-file-name "../bootstrap" doom-packages-dir))
doom--load-path)
custom-theme-load-path
',(append (list (expand-file-name "themes/" doom-private-dir))
custom-theme-load-path))
(load "~/.emacs.local.el" t t)
(setq doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme)
doom-current-font doom-default-font)
,@(mapcar (lambda (pkg) `(require ',pkg)) packages)
(when (display-graphic-p)
(require 'server)
(unless (server-running-p)
(server-start)))
;; Prevent any auto-displayed text + benchmarking
(advice-add 'display-startup-echo-area-message :override 'ignore)
(message ""))))
;;; bootstrap.el ends here

119
init.el
View File

@ -30,72 +30,65 @@
(load (concat user-emacs-directory "bootstrap.el"))
(defconst doom-default-theme 'doom-one)
(defconst doom-terminal-theme 'doom-dark)
(defconst doom-default-font (font-spec :family "Fira Mono" :size 12))
(doom :default-theme doom-one
:terminal-theme doom-dark
:default-font ("Fira Mono" 12)
(defconst doom-leader "," "Prefix for <leader> bindings")
(defconst doom-localleader "\\" "Prefix for <localleader> bindings")
;;; The heart of DOOM
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)
(IS-LINUX 'core-os-linux)
(IS-WINDOWS 'core-os-win32))
;;; Experimental
; module-eshell ; for inferior OSes *cough*windows
; module-org ; for organized fearless leader
;; The heart of DOOM
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
;;; 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
;; 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-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>
;;; Personal
my-commands
my-bindings)
;; 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
))