From c27814ac8c6a776793f3880c2adc54839474762b Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Thu, 12 Sep 2019 22:14:31 -0400 Subject: [PATCH] [emacs] Use literate DOOM Emacs config --- .doom.d/.gitignore | 1 + .doom.d/config.el | 15 ----- .doom.d/config.org | 148 +++++++++++++++++++++++++++++++++++++++++++++ .doom.d/init.el | 4 +- 4 files changed, 151 insertions(+), 17 deletions(-) create mode 100644 .doom.d/.gitignore delete mode 100644 .doom.d/config.el create mode 100644 .doom.d/config.org diff --git a/.doom.d/.gitignore b/.doom.d/.gitignore new file mode 100644 index 0000000..71bc188 --- /dev/null +++ b/.doom.d/.gitignore @@ -0,0 +1 @@ +config.el diff --git a/.doom.d/config.el b/.doom.d/config.el deleted file mode 100644 index 40c14dc..0000000 --- a/.doom.d/config.el +++ /dev/null @@ -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))) diff --git a/.doom.d/config.org b/.doom.d/config.org new file mode 100644 index 0000000..443dbc6 --- /dev/null +++ b/.doom.d/config.org @@ -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) + <>) +#+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 diff --git a/.doom.d/init.el b/.doom.d/init.el index 309b413..27080e1 100644 --- a/.doom.d/init.el +++ b/.doom.d/init.el @@ -51,7 +51,7 @@ ;;lispy ; vim for lisp, for people who dont like vim multiple-cursors ; editing in many places at once ;;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 snippets ; my elves. They type so I don't have to ;;word-wrap ; soft wrapping with language-aware indent @@ -169,7 +169,7 @@ :config ;; For literate config users. This will tangle+compile a config.org ;; literate config in your `doom-private-dir' whenever it changes. - ;;literate + literate ;; The default module sets reasonable defaults for Emacs. It also ;; provides a Spacemacs-inspired keybinding scheme and a smartparens