From 6bc4d5e2710e1bd03af634fdd715072c6a882cec Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 14 Aug 2020 23:40:38 +0100 Subject: ~clean up with documentation generally --- Emacs/.config/emacs/init.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'Emacs/.config/emacs') diff --git a/Emacs/.config/emacs/init.el b/Emacs/.config/emacs/init.el index 0974765..7b554db 100644 --- a/Emacs/.config/emacs/init.el +++ b/Emacs/.config/emacs/init.el @@ -29,19 +29,25 @@ "Load all files in +literate/output-files." (mapc #'(lambda (x) (load-file x)) +literate/output-files)) -(defun +literate/compile-config () - (require 'ob-tangle) - (mapc #'org-babel-tangle-file +literate/files)) - -(defun +literate/files-exist () - "Checks if output files exist, for compilation purposes. Don't use if only one file." +(defun +literate/org-files-exist () + "Checks if output files exist, for compilation purposes." (require 'cl-lib) - (cl-reduce #'(lambda (x y) (and x y)) (mapc #'file-exists-p +literate/output-files) - :initial-value t)) + (if (< 1 (length +literate/output-files)) + (cl-reduce #'(lambda (x y) (and x y)) (mapc #'file-exists-p +literate/output-files) + :initial-value t) + (file-exists-p (car +literate/output-files)))) + +(defun +literate/compile-config () + "Compile all files in +literate/org-files via org-babel-tangle." + (mapc #'org-babel-tangle-file +literate/org-files)) -(add-hook 'kill-emacs-hook #'+literate/compile-config) +;; Killing Emacs hook +(add-hook + 'kill-emacs-hook + #'+literate/compile-config) -(unless (file-exists-p "config.el") ; only one file +;; When no output files exist, compile +(unless (+literate/org-files-exist) (+literate/compile-config)) (+literate/load-config) -- cgit v1.2.3-13-gbd6f