1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#+title: Emacs configuration and personal packages
#+property: header-args :tangle ~/.emacs.d/init.el :comments no :results silent
#+auto_tangle: t
* Bootstrap
This is the emacs standard init file, which will load (maybe
tangled) the file [[./init.org][init.org]], checking first whether a fresh tangle is
needed. Note that the rest of elisp tangling in init.org goes to a
different file (namely, the one that is loaded by
=~/.emacs.d/init.el=).
However, also note that if [[https://github.com/jingtaozf/literate-elisp/blob/master/literate-elisp.org][literate-elisp]] is installed, we load
instead the org file, directly. It's because of that that we start
by setting up packages. A drawback of literate-elisp is that it
only knows how to load with lexical binding set to nil, so i tend to
prefer just loading tangled .el files. The packages [[https://github.com/yilkalargaw/org-auto-tangle][org-auto-tangle]]
(to asyncronously generate those files) and [[https://github.com/tarsius/orglink][orglink]] (to easily
navigate between the two flavours) come in handy in that scenario.
Here's the directory where a checkout of this repo lives:
#+begin_src emacs-lisp
(defvar jao-emacs-dir (expand-file-name "~/etc/emacs"))
#+end_src
followed by package.el's initialisation:
#+begin_src emacs-lisp
(setq package-user-dir
(expand-file-name (format "~/.emacs.d/elpa.%s" emacs-major-version))
package-check-signature 'allow-unsigned)
(require 'package)
(dolist (a '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")))
(add-to-list 'package-archives a t))
(package-initialize)
#+end_src
and a couple of tangling helper:
#+begin_src emacs-lisp
(defun jao-maybe-tangle (basename)
(let ((el (expand-file-name (format "%s.el" basename) jao-emacs-dir))
(org (expand-file-name (format "%s.org" basename) jao-emacs-dir)))
(when (file-newer-than-file-p org el)
(require 'ob-tangle)
(org-babel-tangle-file org el))
el))
(defun jao-load-org (file)
(let ((b (file-name-sans-extension file)))
(if (require 'literate-elisp nil t)
(let ((file (format "%s.org" b)))
(literate-elisp-load-file (expand-file-name file jao-emacs-dir)))
(load-file (jao-maybe-tangle b)))))
#+end_src
Finally, we load either init.org or its tangled version from
~jao-emacs-dir~:
#+begin_src emacs-lisp
(jao-load-org "init")
#+end_src
You can tangle this readme to generate the minimal init.el file above.
* Configuration as a set of literate files
- [[./init.org][init.org]]: main configuration as a literate org file; it uses
(besides lots of packages), many of my libraries in [[./lib][lib]], and loads
on demand the other org files below.
- [[./completion.org][completion.org]]: completion setup using corfu, vertico, consult and
friends.
- [[./org.org][org.org]] org mode configuration.
- [[./blog.org][blog.org]]: blogging using org-static-blog.
- [[./email.org][email.org]]: generic email handling in emacs.
- [[./gnus.org][gnus.org]]: tangled to gnus.el automatically by init.org, so that it's
ready for loading by Gnus.
- [[./eww.org][eww.org]]: browsing with eww.
- [[./exwm.org][exwm.org]]: configuration for exwm, loaded when ~jao-exwmn-enable~ is
called.
The [[./attic][attic]] contains other literate configuration files not currently
used by init.org, like [[./attic/counsel.org][counsel.org]] for old ivy-based completion, or
[[file:attic/w3m.org][w3m.org]] for an emacs-w3m configuration i used for many years.
|