Emacs: advanced Org literate configuration

  Рет қаралды 7,253

Protesilaos Stavrou

Protesilaos Stavrou

7 ай бұрын

In this ~25 minute video, I present my new Emacs configuration. It is an advanced setup that starts with a literate Org program as the "source of truth". This file generates all the individual modules and custom libraries of my setup. I explain all the technicalities and why this approach is the best of both worlds to (i) document the rich corpus of work found in my dotfiles while (ii) not compromising on code excellence.
+ Website: protesilaos.com/emacs/dotemacs
+ Git repo on SourceHut: git.sr.ht/~protesilaos/dotfiles
- Mirrors:
+ GitHub: github.com/protesilaos/dotfiles
+ GitLab: gitlab.com/protesilaos/dotfiles
+ Mailing list: lists.sr.ht/~protesilaos/dotf...
+ Backronym: Do Observe, Transpose, Examine, or Mirror All Configurations, Stranger (dotemacs); Dotfiles Operate Transparently For the Included Linux and Emacs Setups (dotfiles).

Пікірлер: 57
@hexdump1337
@hexdump1337 7 ай бұрын
Your contributions are always extremely useful, thank you
@protesilaos
@protesilaos 7 ай бұрын
You are welcome!
@auntiecarol
@auntiecarol 7 ай бұрын
The youtube algorithm loves comments, so this is mine: - Love the "prot-gruvbox" theme! - Literate configs are great especially for times when you need to write many configs in many different places… one's mbsync config, one's not muchconfig, systemd timers etc all related to mail but in many different places. (And perversely I tangle my vimrc from an org file 😂)
@protesilaos
@protesilaos 7 ай бұрын
Good points! I don't know if I will go all the way to make it generate every dotfile, though doing so keep things consistent. The theme is 'ef-melissa-dark' from my 'ef-themes' package ("melissa" means "bee" in Greek): github.com/protesilaos/ef-themes
@auntiecarol
@auntiecarol 7 ай бұрын
@@protesilaos Nix or Guix people would prove me wrong, but it seems feasible that one could set up a whole system configuration file in org. Tangle the whole damned environment! (I've been drinking, so there's a good chance i am wrong)
@protesilaos
@protesilaos 6 ай бұрын
@@auntiecarol Well, I have not been drinking and am inclined to agree. Haha!
@susanpinochet
@susanpinochet 7 ай бұрын
I've been thinking about doing this with my emacs configs, but I wasn't sure how to go about it. This is exactly the resource I needed from a source I trust. I will be studying it carefully.
@protesilaos
@protesilaos 7 ай бұрын
Very well! Make sure to try it with test files before switching to the real ones. I did it by prefixing "TEST-" to the actual names. I compared the results with what I already had and once I was sure everything was correct, I removed the prefix. Let me know if you need any help.
@goparism
@goparism 7 ай бұрын
Absolutely amazing content as always. Didn't think of tangling.
@protesilaos
@protesilaos 7 ай бұрын
You are welcome! Tangling is a neat feature for such a case.
@LucaCanali
@LucaCanali 7 ай бұрын
Another really awesome contributes ... thank you so much !!! 💪
@protesilaos
@protesilaos 7 ай бұрын
You are welcome!
@BrenSmith
@BrenSmith 7 ай бұрын
Amazing, I *always* learn so much watching your videos. Thanks Prot!
@protesilaos
@protesilaos 7 ай бұрын
You are welcome!
@maxreuv
@maxreuv 6 ай бұрын
Excellent, I should certainly try this approach! Thank you!
@protesilaos
@protesilaos 6 ай бұрын
You are welcome!
@lovelovelove6816
@lovelovelove6816 6 ай бұрын
Great video! btw. if it makes sense to you, you could also define the target file for tangling for a whole subtree, so you wouldn't have to repeat the statement for every code-block. Example from my config: * UI (ui.el) :PROPERTIES: :header-args:emacs-lisp: :tangle (expand-file-name "ui.el" mylisp-directory) :END: in this way, all code blocks within this subtree will be tangled in ui.el
@qu4ku
@qu4ku 7 ай бұрын
also, displaying keybindings with description on the bottom was a great idea.
@protesilaos
@protesilaos 7 ай бұрын
This is done by the 'keycast' package. I like it!
@fernseed
@fernseed 7 ай бұрын
Very nice! As someone who has explored your dotfiles directory hierarchy --- and taken plenty of inspiration from it --- I find this format much more approachable. And the new descriptions that you've written so far are surprisingly thorough. I've also been experimenting lately with structuring my init files in a more high-level way (albeit with Guix/Scheme instead of Org), and I find that it ultimately ends up improving "code excellence" by forcing us to be more deliberate in design choices, cut out unnecessary stuff, etc. I look forward to reading more.
@protesilaos
@protesilaos 6 ай бұрын
Good point about code excellence! It is what I think is happening in my case as well. How is Guix working for you on this front? I get the sense it has lots of potential.
@fernseed
@fernseed 6 ай бұрын
​@@protesilaos Yes, the potential of Guix is mostly untapped. I'm to a point where all of my Emacs configuration is done in a single Scheme file (including custom building Emacs itself and installing all packages from source repos). All Elisp that is "configuration", as opposed to something that belongs in its own package, is generated from a list of Scheme objects that hold configuration data for each package --- so, e.g., you could switch from generating Elisp with `prot-emacs-package' macros to `use-package' by plugging in a new translator function. Perhaps extreme, but it has certainly improved my Emacs experience in unexpected ways!
@connorcreegan
@connorcreegan 6 ай бұрын
Very helpful. Thanks a lot.
@0netom
@0netom 7 ай бұрын
Perfection!
@protesilaos
@protesilaos 7 ай бұрын
Thanks!
@johnhammer8668
@johnhammer8668 7 ай бұрын
Thanks very much Prot.
@protesilaos
@protesilaos 7 ай бұрын
You are welcome!
@cliosport1374
@cliosport1374 7 ай бұрын
Thanks a lot!!! 👍👍👍
@protesilaos
@protesilaos 7 ай бұрын
You are welcome!
@gnu-lynx2501
@gnu-lynx2501 7 ай бұрын
refreshingly based editor macros and literate programming
@protesilaos
@protesilaos 7 ай бұрын
Thank you!
@ricardonunes709
@ricardonunes709 7 ай бұрын
another great video, thanks Prot. been thinking doing that with my dotfiles, but i had doubts about how to do it :D till now... i think
@protesilaos
@protesilaos 7 ай бұрын
You are welcome! Try to tangle to demo files, like what I did in the video. Before switching to this setup, I prefixed each file with "TEST-". I then compared the tangled "TEST-" files with the ones I had and confirmed there were no differences. Then I simply removed the prefix.
@antoniocorbibellot6532
@antoniocorbibellot6532 6 ай бұрын
@@protesilaos I'm using option "--init-directory" to change temporarily the directory where emacs searches for init files and it seems to work.
@protesilaos
@protesilaos 6 ай бұрын
@@antoniocorbibellot6532 Very well!
@rashie
@rashie 7 ай бұрын
👍👍
@protesilaos
@protesilaos 7 ай бұрын
Thanks!
@HarishNarayanan
@HarishNarayanan 6 ай бұрын
No problem, no stress
@protesilaos
@protesilaos 6 ай бұрын
A phrase I use frequently, haha!
@HarishNarayanan
@HarishNarayanan 6 ай бұрын
@@protesilaosI love it. Thank you for all that you do.
@protesilaos
@protesilaos 6 ай бұрын
@HarishNarayanan You are welcome!
@sus4793
@sus4793 6 ай бұрын
You somehow managed to make a better looking Emacs than Doom Emacs ;)
@__-oe6wn
@__-oe6wn 7 ай бұрын
good to know to use :tangle to dump source code from org-mdoe to external file system. 2. happy to learn C-c C-v C-d technique. Question: why you don't use default ID? I really like this idea. I will use the concept in my Workflow
@protesilaos
@protesilaos 7 ай бұрын
I don't remember why I stopped using the default ID. I think it has to do with the HTML export, which was not producing the desired internal links. I must check the code again.
@alexandrewaechter7585
@alexandrewaechter7585 3 ай бұрын
Hello Prot. Once again thanks a lot for the video and the exaplanations. Wonderful, great methodology. I was wondering how to document my init file, at least for me for the moment, but your method looks perfect. I have already switched. I'm just wondering how to deal with automatically added code by emacs, but it's may be just a beginner problem. Take Care.
@protesilaos
@protesilaos 3 ай бұрын
You can put the automatically added code in another file, known as the 'custom-file', by simply defining a path to that file. Then load that file from your configuration: load it at the start, if you want to potentially override it later, or at the end to not override it. To set this up, check the following code: ;; Let the `custom-file' to a file called "custom.el" inside of the ;; user's Emacs directory, whichever that is. (setq custom-file (locate-user-emacs-file "custom.el")) ;; Try to load the `custom-file'. Do not produce an error if the file ;; is missing: just ignore it (so we do not have an error while ;; starting up). (load custom-file :no-error)
@alexandrewaechter7585
@alexandrewaechter7585 3 ай бұрын
@@protesilaos oh great, thank you for you reply. I will try that.
@antoniocorbibellot6532
@antoniocorbibellot6532 6 ай бұрын
Hi Prot! Very useful video, thx! Would it be useful for you the "#+auto_tangle: t" property? With it in your file, you only have to save the file and it tangles all the blocks automagically.
@protesilaos
@protesilaos 6 ай бұрын
I have not tried it in earnest but I will check. Thank you!
@antoniocorbibellot6532
@antoniocorbibellot6532 6 ай бұрын
@@protesilaos Hi Prot! I forgot to say that it dependes on package "org-auto-tangle", hope this helps you.
@JonnyAlexander3
@JonnyAlexander3 7 ай бұрын
What is the difference in startup time from not using org-babel-load-file?
@protesilaos
@protesilaos 7 ай бұрын
I don't remember the exact values, but the old method felt considerably slower.
@giorgosK936
@giorgosK936 Ай бұрын
high iq setup
Emacs: multilingual editing (Greek, French, Chinese, etc.)
11:00
Protesilaos Stavrou
Рет қаралды 2,5 М.
Emacs: mark and register basics
35:34
Protesilaos Stavrou
Рет қаралды 6 М.
That's how money comes into our family
00:14
Mamasoboliha
Рет қаралды 11 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 62 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 26 МЛН
Every LLM in Emacs, with gptel
17:56
karthink
Рет қаралды 9 М.
Emacs: introduction to Denote (simple note-taking)
39:04
Protesilaos Stavrou
Рет қаралды 19 М.
Guile, Guix and WASM, the future of the Web?
52:13
guix.social
Рет қаралды 798
Emacs: modern minibuffer packages (Vertico, Consult, etc.)
44:01
Protesilaos Stavrou
Рет қаралды 12 М.
Emacs: file and Dired basics
1:02:38
Protesilaos Stavrou
Рет қаралды 12 М.
Emacs: customize fonts (generic method and 'fontaine' package)
27:16
Protesilaos Stavrou
Рет қаралды 4,2 М.
What Are The Benefits Of Emacs Over Vim?
29:44
DistroTube
Рет қаралды 171 М.
Emacs: completion framework (Embark,Consult,Orderless,etc.)
46:58
Protesilaos Stavrou
Рет қаралды 15 М.