blob: d2dd3e032d1e21d4fc3163e320ae9d018cf0add3 (
plain)
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
|
+++
title = "Emacs: Literate configuration of Elfeed"
author = ["Michał Sapka"]
date = 2023-06-02T23:00:00+02:00
categories = ["emacs"]
draft = false
weight = 2005
abstract = "Setting up config inside an org file"
aliases = ["/2023/elfeed-literate-config/"]
[menu]
[menu.emacs]
weight = 2005
identifier = "emacs-literate-configuration-of-elfeed"
parent = "elfeed"
name = "Literate configuration"
+++
Recently I've been toying with a literate configuration[^fn:1] of Emacs.
My init.el took a straightforward form:
```emacs-lisp
(org-babel-load-file "~/.emacs.d/config.org")
```
And all of my configuration lives in an org-file.
This alone gives me very little benefit for now, but in the future, it will make it easier to have it as a dedicated page on this site.
However, one thing completely surprised me: the elfeed configuration.
Until now, I used the standard way of configuring feeds with Elisp.
It works, but what it is not is readable.
A list of:
```emacs-lisp
("https://gideonwolfe.com/index.xml" blog imporant)
("https://fabiensanglard.net/rss.xml" blog important)
("https://protesilaos.com/master.xml" emacs)
```
is far from being manageable and requires constant manual labor.
## Elfeed-org {#elfeed-org}
One of the packages expanding capabilities of elfeed is elfeed-org[^fn:2].
It allows configuring the list of feeds with a standard org tree.
Since my config is now also an org file, nothing stops me from adding the list as an org-tree inside my config org-file! I set it up via:
{{<highlight lisp "linenos=table,linenostart=199,hl_lines=7">}}
```org
*** elfeed-org
#+BEGIN_SRC emacs-lisp
(use-package elfeed-org
:ensure t
:config
(setq rmh-elfeed-org-files (list "~/.emacs.d/config.org"))
(elfeed-org))
#+END_SRC
```
Therefore, I am now pointing at the same file to become the data source for elfeed-org as the rest of my config.
Just a few lines down, I start to define my list of subscriptions:
```org
*** Feeds :elfeed:
**** Blogs
***** https://gideonwolfe.com/index.xml :important:
***** https://fabiensanglard.net/rss.xml. :important:
**** Emacs
***** https://protesilaos.com/master.xml :important:
```
Much more readable! Elfeed-org will ignore the entire outer tree and extract the feeds from leaves under the \`:elfeed:\` tag.
[^fn:1]: : <https://en.wikipedia.org/wiki/Literate_programming>
[^fn:2]: : <https://github.com/remyhonig/elfeed-org>
|