docs(emacs): user user-lisp/ dir instead of plain lisp/ dir
Also precompile user-lisp content if the ELC files are older than their original source file.
This commit is contained in:
@@ -78,6 +78,8 @@ block.
|
||||
#+end_src
|
||||
|
||||
** Loading All Configuration Modules
|
||||
Here are all my Emacs configuration modules, each dedicated to a
|
||||
specific aspect of my Emacs configuration.
|
||||
|
||||
#+name: emacs-modules
|
||||
| Module Name | Config Page |
|
||||
@@ -98,27 +100,58 @@ block.
|
||||
| =visual-config.el= | [[file:./packages/visual-config.org][Packages — Visual Configuration]] |
|
||||
| =keybindings.el= | [[file:./keybindings.org][Keybindings]] |
|
||||
|
||||
#+name: generate-modules
|
||||
#+begin_src emacs-lisp :tangle no :cache yes :var modules=emacs-modules :exports none
|
||||
(mapconcat (lambda (line)
|
||||
(concat "\"" (string-trim (car line) "=" "=") "\""))
|
||||
modules
|
||||
" ")
|
||||
#+name: modules
|
||||
#+begin_src emacs-lisp :tangle no :cache yes :var modules=emacs-modules :exports none :results list
|
||||
(mapcar (lambda (module) (string-trim (car module) "=" "="))
|
||||
modules)
|
||||
#+end_src
|
||||
|
||||
#+RESULTS[05f9bb535bec2ba84390cc118600323683f51e7c]: generate-modules
|
||||
: "basic-config.el" "custom-elisp.el" "package-manager.el" "keybinding-managers.el" "applications.el" "autocompletion.el" "editing.el" "emacs-builtin.el" "helpful.el" "latex.el" "misc.el" "org.el" "programming.el" "visual-config.el" "keybindings.el"
|
||||
#+RESULTS[1c6034eb268577137e95a6f828c249fc306943b1]: modules
|
||||
- basic-config.el
|
||||
- custom-elisp.el
|
||||
- package-manager.el
|
||||
- keybinding-managers.el
|
||||
- applications.el
|
||||
- autocompletion.el
|
||||
- editing.el
|
||||
- emacs-builtin.el
|
||||
- helpful.el
|
||||
- latex.el
|
||||
- misc.el
|
||||
- org.el
|
||||
- programming.el
|
||||
- visual-config.el
|
||||
- keybindings.el
|
||||
|
||||
#+begin_src emacs-lisp :noweb yes
|
||||
(dolist (module '(<<generate-modules()>>))
|
||||
The first thing Emacs does is verify if any of these modules need to
|
||||
be byte-compiled again, i.e. if the =.el= file is younger than its
|
||||
corresponding =.elc= file. If so, the =.el= file is byte-compiled.
|
||||
|
||||
#+begin_src emacs-lisp :var modules=modules :results none
|
||||
(defun my/mtime (file)
|
||||
"Get the modification time of FILE as a timestamp."
|
||||
(let* ((current-time-list nil)
|
||||
(attr (file-attributes file))
|
||||
(time-attr (file-attribute-modification-time attr)))
|
||||
(/ (car time-attr) (cdr time-attr))))
|
||||
|
||||
;; `modules' is a variable created by org-mode from the table of modules
|
||||
(let* ((config-dir (expand-file-name "user-lisp" user-emacs-directory))
|
||||
(modules (mapcar (lambda (module)
|
||||
(file-name-sans-extension (expand-file-name module config-dir)))
|
||||
modules)))
|
||||
(dolist (module modules)
|
||||
(let* ((el-file (concat module ".el"))
|
||||
(elc-file (concat module ".elc"))
|
||||
(el-last-change (my/mtime el-file))
|
||||
(elc-last-change (if (file-exists-p elc-file) (my/mtime elc-file) 0)))
|
||||
(when (> el-last-change elc-last-change)
|
||||
(byte-compile-file el-file)))))
|
||||
#+end_src
|
||||
|
||||
Now we can load them.
|
||||
#+begin_src emacs-lisp :var modules=modules :results none
|
||||
(dolist (module (mapcar #'file-name-sans-extension modules))
|
||||
(load (expand-file-name module
|
||||
(expand-file-name "lisp" user-emacs-directory))))
|
||||
(expand-file-name "user-lisp" user-emacs-directory))))
|
||||
#+end_src
|
||||
|
||||
* TODOs :noexport:
|
||||
** TODO advise ~evil-insert~ in eshell
|
||||
Advise ~evil-insert~ to go to the end of the buffer while in
|
||||
~eshell-mode~.
|
||||
|
||||
** DONE Get started with org-roam
|
||||
CLOSED: [2023-06-17 Sat 13:38]
|
||||
|
||||
Reference in New Issue
Block a user