diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-08-10 12:27:49 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-08-10 12:27:49 +0100 |
commit | 739636d0a98f76ba5746a7d6a54cbb9be492e7e6 (patch) | |
tree | 02046bdd4f4f7b78eae489a05de46b0c28df9b9a | |
parent | ecade8210c5b350897fac94efa36e251dbc05b2a (diff) | |
download | dotfiles-739636d0a98f76ba5746a7d6a54cbb9be492e7e6.tar.gz dotfiles-739636d0a98f76ba5746a7d6a54cbb9be492e7e6.tar.bz2 dotfiles-739636d0a98f76ba5746a7d6a54cbb9be492e7e6.zip |
~clean up init.el literate code
-rw-r--r-- | Emacs/.config/emacs/init.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Emacs/.config/emacs/init.el b/Emacs/.config/emacs/init.el index ee9e139..868e3ef 100644 --- a/Emacs/.config/emacs/init.el +++ b/Emacs/.config/emacs/init.el @@ -2,23 +2,28 @@ (setq user-emacs-directory "~/.config/emacs/") (defconst +literate/files (list "config.org")) (defconst +literate/output-files (mapcar #'(lambda (x) (replace-regexp-in-string ".org" ".el" x)) +literate/files)) -(message "%s" +literate/output-files) (defun +literate/load-config () (mapc #'(lambda (x) (load-file (concat user-emacs-directory x))) +literate/output-files)) (defun +literate/compile-config () + (interactive) (require 'ob-tangle) - (mapc #'(lambda (x) (org-babel-tangle-file (concat user-emacs-directory x))) +literate/files)) + (mapc #'org-babel-tangle-file +literate/files)) (defun +literate/files-exist () - (cl-reduce #'(lambda (x y) (or x y)) (mapc #'(lambda (x) (file-exists-p (concat user-emacs-directory x))) +literate/output-files))) + "Checks if output files exist, for compilation purposes. Don't use if only one file." + (require 'cl-lib) + (cl-reduce #'(lambda (x y) (and x y)) (mapc #'file-exists-p +literate/output-files) + :initial-value t)) (add-hook 'kill-emacs-hook #'+literate/compile-config) -(unless (+literate/files-exist) + +(unless (file-exists-p "config.el") ; only one file (+literate/compile-config)) (+literate/load-config) + (when (daemonp) (require 'org) (require 'notmuch) |