diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2022-09-14 00:35:37 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2022-09-14 00:47:16 +0100 |
commit | 61f06ef0c86ce078489ed16274df459cf5f40d14 (patch) | |
tree | 08d8aa646271268d194806375bc085ed81daf373 /Emacs/.config | |
parent | 4767422b39daeaf2a155192520f94f49a12071af (diff) | |
download | dotfiles-61f06ef0c86ce078489ed16274df459cf5f40d14.tar.gz dotfiles-61f06ef0c86ce078489ed16274df459cf5f40d14.tar.bz2 dotfiles-61f06ef0c86ce078489ed16274df459cf5f40d14.zip |
(Emacs)~init.el literate functions
To remove the ~(require 'cl)~ dependency, I wrote my own reduce for
boolean values, recursive, which should do the trick. Mostly just to
remove the annoying "haha no cl library anymore".
Diffstat (limited to 'Emacs/.config')
-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) |