diff options
-rw-r--r-- | Emacs/.config/emacs/init.el | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Emacs/.config/emacs/init.el b/Emacs/.config/emacs/init.el index f84cb6a..46facd4 100644 --- a/Emacs/.config/emacs/init.el +++ b/Emacs/.config/emacs/init.el @@ -53,19 +53,24 @@ (defconst +literate/output-files (mapcar #'(lambda (x) (replace-regexp-in-string ".org" ".el" x)) +literate/org-files)) -(defun +literate/load-config () - "Load all files in +literate/output-files." - (interactive) - (mapc #'(lambda (x) (load-file x)) +literate/output-files)) +;; Setup predicates and loading + +(defun +literate/--reduce-bool (bools init) + (if (= (length bools) 0) + init + (+literate/--reduce-bool (cdr bools) (and (car bools) init)))) -(defun +literate/org-files-exist () +(defun +literate/output-files-exist () "Checks if output files exist, for compilation purposes." - (require 'cl-lib) (if (< 1 (length +literate/output-files)) - (cl-reduce #'(lambda (x y) (and x y)) (mapc #'file-exists-p +literate/output-files) - :initial-value t) + (+literate/--reduce-bool (mapc #'file-exists-p +literate/output-files) t) (file-exists-p (car +literate/output-files)))) +(defun +literate/load-config () + "Load all files in +literate/output-files." + (interactive) + (mapc #'(lambda (x) (load-file x)) +literate/output-files)) + (autoload #'org-babel-tangle-file "ob-tangle") (defun +literate/compile-config () "Compile all files in +literate/org-files via org-babel-tangle." @@ -83,7 +88,7 @@ 'kill-emacs-hook #'+literate/compile-config) -(unless (+literate/org-files-exist) +(unless (+literate/output-files-exist) (+literate/compile-config)) (+literate/load-config) |