diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-09-29 22:30:58 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-09-29 22:30:58 +0100 |
commit | a0a5b2e05d3beae7ed3d5ed14b6b65bbc811c7a9 (patch) | |
tree | b0482444d66b598c13aa47636306aa42986de8d2 /Emacs/.config/emacs/elisp/literate.el | |
parent | cc25dcf8121c7a0431f5fc1f27675b1229818041 (diff) | |
download | dotfiles-a0a5b2e05d3beae7ed3d5ed14b6b65bbc811c7a9.tar.gz dotfiles-a0a5b2e05d3beae7ed3d5ed14b6b65bbc811c7a9.tar.bz2 dotfiles-a0a5b2e05d3beae7ed3d5ed14b6b65bbc811c7a9.zip |
(Emacs)~config->app,core
The two largest sections of my config are separated into their own
files now. Does increase init time, but I just can't handle how big
this thing is. It'll be a bit nicer to look at and manage with
separate files.
Diffstat (limited to 'Emacs/.config/emacs/elisp/literate.el')
-rw-r--r-- | Emacs/.config/emacs/elisp/literate.el | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/Emacs/.config/emacs/elisp/literate.el b/Emacs/.config/emacs/elisp/literate.el index 67ee88e..114c3bb 100644 --- a/Emacs/.config/emacs/elisp/literate.el +++ b/Emacs/.config/emacs/elisp/literate.el @@ -33,7 +33,17 @@ (cons first (+literate/filter predicate rest)) (+literate/filter predicate rest))))) -(defconst +literate/org-files (list (concat user-emacs-directory "config.org"))) +(defun +literate/org-p (filename) + (string= "org" (file-name-extension filename))) + +(defun +literate/el-p (filename) + (string= "el" (file-name-extension filename))) + +(defconst +literate/org-files + (+literate/filter + #'+literate/org-p + (mapcar #'(lambda (file) (concat user-emacs-directory file)) + (cddr (directory-files user-emacs-directory))))) (defconst +literate/output-files (mapcar #'(lambda (x) (replace-regexp-in-string ".org" ".el" x)) +literate/org-files)) @@ -41,11 +51,12 @@ (defconst +literate/elisp-files `(,(concat user-emacs-directory "early-init.el") ,(concat user-emacs-directory "init.el") + ,@+literate/output-files ,@(mapcar #'(lambda (name) (concat user-emacs-directory "elisp/" name)) ;; Only take .el files (+literate/filter - (lambda (name) (string= "el" (file-name-extension name))) + #'+literate/el-p (cddr (directory-files (concat user-emacs-directory "elisp/"))))))) ;; Setup predicates and loading @@ -62,14 +73,15 @@ (file-exists-p (car +literate/output-files)))) (defun +literate/load-config () - "Load all files in +literate/output-files." + "Load the first file in +literate/output-files." (interactive) - (mapc #'(lambda (x) (load-file x)) +literate/output-files)) + (load-file (concat user-emacs-directory "config.el"))) (autoload #'org-babel-tangle-file "ob-tangle") (defun +literate/tangle-if-old (org-file) (let ((output-file (replace-regexp-in-string ".org" ".el" org-file))) + (message "Tangle(%s)->%s" org-file output-file) (if (or (not (file-exists-p output-file)) (file-newer-than-file-p org-file output-file)) (org-babel-tangle-file org-file)))) @@ -88,7 +100,7 @@ (message "Byte-compiling literate files...") (mapc #'+literate/byte-compile-if-old +literate/output-files) (message "Literate files byte-compiled") - (message "Byte compiling init.el, early-init.el, elisp/*") + (message "Byte compiling init.el, early-init.el, *.org~>*.el elisp/*") (mapc #'+literate/byte-compile-if-old +literate/elisp-files) (message "Finished byte-compiling")) |