diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Doom/.doom.d/config.el | 2 | ||||
-rw-r--r-- | Doom/.doom.d/org/config.org | 9 | ||||
-rw-r--r-- | Doom/.doom.d/org/literate.org | 45 | ||||
-rw-r--r-- | Doom/.doom.d/packages.el | 2 |
5 files changed, 31 insertions, 29 deletions
@@ -1,6 +1,6 @@ TAGS -Doom/.doom.d/bin/*.el mpd/* ncmpcpp/* Emacs/.config/emacs/transient/* Emacs/.config/emacs/straight/* +/Doom/.doom.d/org/*.el diff --git a/Doom/.doom.d/config.el b/Doom/.doom.d/config.el index 8c4c242..4f1bb94 100644 --- a/Doom/.doom.d/config.el +++ b/Doom/.doom.d/config.el @@ -1,3 +1,3 @@ ;;; ~/Dotfiles/doom.d/config.el -*- lexical-binding: t; -*- -(load! "bin/config.el") +(org-babel-load-file (concat doom-private-dir "org/config.org")) diff --git a/Doom/.doom.d/org/config.org b/Doom/.doom.d/org/config.org index 829dd4d..c23ec38 100644 --- a/Doom/.doom.d/org/config.org +++ b/Doom/.doom.d/org/config.org @@ -11,9 +11,14 @@ * Init Initialize literate config and setup some basic variables ** Bootstrap -Load the literate.el file to start parsing. +Declare variable for org files I want to compile #+BEGIN_SRC elisp -(load (expand-file-name (concat doom-private-dir "bin/literate.el"))) +(defvar dx:literate/org-files '("personal.org")) +#+END_SRC + +Then just iterate and load them via =org-babel-load-file=. +#+BEGIN_SRC elisp +(cl-loop for file in dx:literate/org-files do (org-babel-load-file (concat doom-private-dir "org/" file))) #+END_SRC ** Doom Variables - Set the doom localleader to "," because it's faster diff --git a/Doom/.doom.d/org/literate.org b/Doom/.doom.d/org/literate.org index d3c9d11..53bd6a2 100644 --- a/Doom/.doom.d/org/literate.org +++ b/Doom/.doom.d/org/literate.org @@ -1,24 +1,25 @@ -#+TITLE: Literate configuration +#+TITLE: Literate configuration (NO LONGER IN USE) * Preclude -My setup to produce a literate configuration. Allows me to write org files all -around the /doom-private-dir/ and access them. Also shaved like 0.2s off my -loading time. +My setup to produce a literate configuration. +Allows me to write org files all around the /doom-private-dir/ and access them. +Also shaved like 0.2s off my loading time. + +/Note/: My current literate system now uses the =org-babel-load*= functions to handle most of the hard work. +It's easier to use and manage, and I just don't use that many org files anymore so no need for such a big setup. * Constants Initialise some basic constants for where stuff is. - literate/bin-dir: Where to compile to - literate/preloaded-files: Relative to ~$DOOM~, which files are already preloaded/don't need to be compiled #+BEGIN_SRC elisp -(defvar dx:literate/bin-dir (expand-file-name (concat doom-private-dir "bin/")) "Directory to store elisp compiled files") -(defvar dx:literate/load-files '("~/.doom.d/org/personal.org") "Files to load after compilation") +(defconst dx:literate/bin-dir (expand-file-name (concat doom-private-dir "bin/")) "Directory to store elisp compiled files") +(defconst dx:literate/load-files '("~/.doom.d/org/personal.org") "Files to load after compilation") +(defconst dx:literate/directory (expand-file-name (concat doom-private-dir "org/")) "Directory to get org files from") #+END_SRC * Remove function -When loading the lisp, we need to load everything excluding "config.el" -(preloaded by doom) and "literate.el" (loaded by "config.el"). We'll make a very -specific remove function that will remove entries from a given list and return -the new list, given the fact that the files variable will be a list of fully -expanded file names. +When loading the lisp, we need to load everything excluding "config.el" (preloaded by doom) and "literate.el" (loaded by "config.el"). +We'll make a very specific remove function that will remove entries from a given list and return the new list, given the fact that the files variable will be a list of fully expanded file names. #+BEGIN_SRC elisp (defun dx:literate/remove-mult (remove-files files) "Remove any occurrences of `remove-files' from `files'" @@ -28,10 +29,8 @@ expanded file names. (remove-if #'(lambda (l) (member l parsed-remove-files)) files))) ; remove any files that are in the remove-files #+END_SRC * Destination for parser -Generate the destination for a literate config org file to parse to, in this -case the bin folder in the private directory -This is not fitted onto the parser because the parser could be fitted to -multiple /differing/ outputs easily if it isn't specified a destination. +Generate the destination for a literate config org file to parse to, in this case the bin folder in the private directory. +This is not fitted onto the parser because the parser could be fitted to multiple /differing/ outputs easily if it isn't specified a destination. #+BEGIN_SRC elisp (defun dx:literate/destination(SRC) "Parse a src.org file to a bin/src.el file" @@ -40,9 +39,8 @@ multiple /differing/ outputs easily if it isn't specified a destination. #+END_SRC * Parser ** Tangle function -First we need to get some sort of parser which can, given a source org file and -a destination, parse and produce an Emacs lisp file. We'll copy this from the -literate module of doom. +First we need to get some sort of parser which can, given a source org file and a destination, parse and produce an Emacs lisp file. +We'll copy this from the literate module of doom. #+BEGIN_SRC elisp (defun dx:literate/tangle (SRC DEST) "Tangle a source org file into a destination el file using a new emacs instance" @@ -60,16 +58,15 @@ literate module of doom. "*org-tangle-errors*")))))) #+END_SRC ** Popup rules -I don't want Emacs to focus onto the output buffer of the tangling process when I save, which is what happens with a standard async-shell-command. So setup a rule for the 'messages' and 'errors' buffers to not focus them (by setting their time to live to 0). +I don't want Emacs to focus onto the output buffer of the tangling process when I save, which is what happens with a standard async-shell-command. +So setup a rule for the 'messages' and 'errors' buffers to not focus them (by setting their time to live to 0). #+BEGIN_SRC elisp (set-popup-rule! "\*org-tangle-.*" :ttl 0 :quit t) #+END_SRC * Hook on save -Now we need to make a hook function that, when the current buffer is an org file -in the doom directory, will run the literate config procedure from above. Use -this hook function and add it to the after-save-hook once org mode has been -loaded. README.org has been added as an exception because it doesn't contain -literate contents. +Now we need to make a hook function that, when the current buffer is an org file in the doom directory, will run the literate config procedure from above. +Use this hook function and add it to the after-save-hook once org mode has been loaded. +README.org has been added as an exception because it doesn't contain literate contents. #+BEGIN_SRC elisp (defun dx:literate/compile-hook () "Any org file within $DOOM/org will be compiled on save" diff --git a/Doom/.doom.d/packages.el b/Doom/.doom.d/packages.el index 96fa3e6..d8532fd 100644 --- a/Doom/.doom.d/packages.el +++ b/Doom/.doom.d/packages.el @@ -1,4 +1,4 @@ ;; -*- no-byte-compile: t; -*- ;;; ~/.doom.d/packages.el -(load! "bin/packages.el") +(org-babel-load-file (expand-file-name (concat doom-private-dir "org/packages.org"))) |