aboutsummaryrefslogtreecommitdiff
path: root/Emacs
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2020-08-14 23:40:38 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2020-08-14 23:41:03 +0100
commit6bc4d5e2710e1bd03af634fdd715072c6a882cec (patch)
tree403c446f68cfc0297d6fe7243f10667704932fb7 /Emacs
parentc97ffe9fde4ad2f98268471840ff286f26fd4d5f (diff)
downloaddotfiles-6bc4d5e2710e1bd03af634fdd715072c6a882cec.tar.gz
dotfiles-6bc4d5e2710e1bd03af634fdd715072c6a882cec.tar.bz2
dotfiles-6bc4d5e2710e1bd03af634fdd715072c6a882cec.zip
~clean up with documentation generally
Diffstat (limited to 'Emacs')
-rw-r--r--Emacs/.config/emacs/init.el26
1 files changed, 16 insertions, 10 deletions
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)