aboutsummaryrefslogtreecommitdiff
path: root/doom.d/modules
diff options
context:
space:
mode:
authorAChavali <aryadevchavali1@gmail.com>2020-02-09 12:36:36 +0000
committerAChavali <aryadevchavali1@gmail.com>2020-02-09 12:36:36 +0000
commitcf651fe3752256a8950ecc875ff6556ba9b55f2a (patch)
treebfd2ab9fab8ad10a05670b8b10f71e08c8fd3ca9 /doom.d/modules
parentd7aee574f4680290780bd7c37bd00436e40fc764 (diff)
downloaddotfiles-cf651fe3752256a8950ecc875ff6556ba9b55f2a.tar.gz
dotfiles-cf651fe3752256a8950ecc875ff6556ba9b55f2a.tar.bz2
dotfiles-cf651fe3752256a8950ecc875ff6556ba9b55f2a.zip
~formatting, docstrings for functions in literate
Just better formatting and some nice docstrings for easier use in my literate module.
Diffstat (limited to 'doom.d/modules')
-rw-r--r--doom.d/modules/literate.org16
1 files changed, 12 insertions, 4 deletions
diff --git a/doom.d/modules/literate.org b/doom.d/modules/literate.org
index ffb036a..562fb71 100644
--- a/doom.d/modules/literate.org
+++ b/doom.d/modules/literate.org
@@ -8,7 +8,8 @@ loading time.
Initialise some basic constants for where stuff is.
#+BEGIN_SRC elisp
(setq oreodave/literate/bin-dir (expand-file-name (concat doom-private-dir "bin/")))
-(setq oreodave/literate/preloaded-files (list "README.org" "modules/packages.org" "modules/config.org" "modules/literate.org"))
+(setq oreodave/literate/preloaded-files (list "README.org" "modules/packages.org"
+ "modules/config.org" "modules/literate.org"))
#+END_SRC
* Remove function
When loading the lisp, we need to load everything excluding "config.el"
@@ -18,15 +19,20 @@ the new list, given the fact that the files variable will be a list of fully
expanded file names.
#+BEGIN_SRC elisp
(defun oreodave/literate/remove-mult (remove-files files)
- (let ((parsed-remove-files (map 'list #'(lambda (i) (expand-file-name (concat doom-private-dir i))) remove-files)))
- (remove-if-not #'(lambda (l) (not (member l parsed-remove-files))) files)))
+ "Remove any occurrences of `remove-files' from `files'"
+ (let ((parsed-remove-files (map 'list
+ #'(lambda (i) (expand-file-name (concat doom-private-dir i)))
+ remove-files))) ; Generate a list of all fully expanded files to remove
+ (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
#+BEGIN_SRC elisp
(defun oreodave/literate/destination(SRC)
- (replace-regexp-in-string ".*/\\(\\w+\\).org" (expand-file-name (concat oreodave/literate/bin-dir "\\1.el")) SRC))
+ "Parse a src.org file to a bin/src.el file"
+ (replace-regexp-in-string ".*/\\(\\w+\\).org"
+ (expand-file-name (concat oreodave/literate/bin-dir "\\1.el")) SRC))
#+END_SRC
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.
@@ -36,6 +42,7 @@ a destination, parse and produce an Emacs lisp file. We'll copy this from the
literate module of doom.
#+BEGIN_SRC elisp
(defun oreodave/literate/tangle (SRC DEST)
+ "Tangle a source org file into a destination el file using a new emacs instance"
(let ((default-directory doom-private-dir))
(when (file-newer-than-file-p SRC DEST)
(let ((output (get-buffer-create "*org-tangle*")))
@@ -75,6 +82,7 @@ files, using the parser function made. Assume all org files in the "location"
directory contribute to the config.
#+BEGIN_SRC elisp
(defun oreodave/literate/tangle-all (&optional location)
+ "Tangle all org files in `location' to el files in the `destination'"
(or location (setq location doom-private-dir))
(interactive)
(message "Starting compilation process")