[emacs] Use literate DOOM Emacs config

This commit is contained in:
Correl Roush 2019-09-12 22:14:31 -04:00
parent f6704e7dc5
commit c27814ac8c
4 changed files with 151 additions and 17 deletions

1
.doom.d/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
config.el

View file

@ -1,15 +0,0 @@
;;; .doom.d/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here
(defun my/org-init-babel ()
(setq org-src-preserve-indentation nil))
(when (featurep! :lang org)
(add-hook! 'org-mode-hook #'my/org-init-babel)
;; Don't use DOOM's centralized attachment system. It's incompatible with all
;; of the org files I already have using the standard setup.
(setq org-attach-directory "data/")
(remove-hook! 'org-load-hook
#'(+org-init-centralized-attachments-h)))

148
.doom.d/config.org Normal file
View file

@ -0,0 +1,148 @@
#+TITLE: DOOM Emacs Configuration
#+STARTUP: indent
#+PROPERTY: header-args :tangle yes
* Org
:PROPERTIES:
:header-args: :tangle no :noweb-ref org
:END:
#+begin_src emacs-lisp :noweb yes :tangle yes :noweb-ref org-all
(when (featurep! :lang org)
<<org>>)
#+end_src
** Override DOOM indentation behavior
#+begin_src emacs-lisp
(defun my/org-init-babel ()
(setq org-src-preserve-indentation nil))
(add-hook! 'org-mode-hook #'my/org-init-babel)
#+end_src
** Disable DOOM's centralized attachment system
It's incompatible with all of the org files I already have using the standard
setup.
#+begin_src emacs-lisp
(setq org-attach-directory "data/")
(remove-hook! 'org-load-hook
#'(+org-init-centralized-attachments-h))
#+end_src
** LaTeX Export
*** Document Classes
#+BEGIN_SRC emacs-lisp
(use-package! ox-latex
:config
(seq-map (apply-partially #'add-to-list 'org-latex-classes)
'(("koma-letter"
"\\documentclass{scrlttr2}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("koma-article"
"\\documentclass{scrartcl}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("koma-book"
"\\documentclass{scrbook}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("koma-book-chapters"
"\\documentclass{scrbook}"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("koma-report"
"\\documentclass{scrreprt}"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("memoir"
"\\documentclass{memoir}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("hitec"
"\\documentclass{hitec}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("paper"
"\\documentclass{paper}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("letter"
"\\documentclass{letter}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("tufte-handout"
"\\documentclass{tufte-handout}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("tufte-book"
"\\documentclass{tufte-book}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("tufte-book-chapters"
"\\documentclass{tufte-book}"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("labbook"
"\\documentclass{labbook}"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\labday{%s}")
("\\subsubsection{%s}" . "\\experiment{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))))
#+END_SRC
* Auto-loading elisp files
Any elisp files dropped into =~/.doom.local.d/= will be
automatically loaded.
I usually use this is a testing ground for new configuration before
adding it here, and also for any personal / sensitive configuration.
#+BEGIN_SRC emacs-lisp
(defun my/load-elisp-directory (path)
(let ((file-pattern "\\.elc?$"))
(when (file-directory-p path)
(mapcar (lambda (lisp-file)
(load-file lisp-file))
(directory-files (expand-file-name path) t file-pattern)))))
(my/load-elisp-directory "~/.doom.local.d")
#+END_SRC

View file

@ -51,7 +51,7 @@
;;lispy ; vim for lisp, for people who dont like vim ;;lispy ; vim for lisp, for people who dont like vim
multiple-cursors ; editing in many places at once multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent ;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of parinfer ; turn lisp into python, sort of
rotate-text ; cycle region at point between text candidates rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to snippets ; my elves. They type so I don't have to
;;word-wrap ; soft wrapping with language-aware indent ;;word-wrap ; soft wrapping with language-aware indent
@ -169,7 +169,7 @@
:config :config
;; For literate config users. This will tangle+compile a config.org ;; For literate config users. This will tangle+compile a config.org
;; literate config in your `doom-private-dir' whenever it changes. ;; literate config in your `doom-private-dir' whenever it changes.
;;literate literate
;; The default module sets reasonable defaults for Emacs. It also ;; The default module sets reasonable defaults for Emacs. It also
;; provides a Spacemacs-inspired keybinding scheme and a smartparens ;; provides a Spacemacs-inspired keybinding scheme and a smartparens