From 61f06ef0c86ce078489ed16274df459cf5f40d14 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 14 Sep 2022 00:35:37 +0100 Subject: (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". --- Emacs/.config/emacs/init.el | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'Emacs/.config') 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) -- cgit v1.2.3-13-gbd6f