+++ title = "Literate Programming Emacs Configuration" author = ["Elia el Lazkani"] date = 2020-09-12T21:00:00+02:00 lastmod = 2021-06-28T00:01:52+02:00 tags = ["emacs", "org-mode", "configuration"] categories = ["text-editors"] draft = false +++ I was working on a _project_ that required a lot of manual steps. I _generally_ lean towards **automating everything** but in _some cases_ that is, unfortunately, not possible. Documenting such project is not an easy task to accomplish, especially with so many moving parts and different outputs. Since I have been using _org-mode_ more frequently for _documentation_ and _organization_ in general, I gravitated towards it as a first instinct. I wasn't sure of the capabilities of _org-mode_ in such unfamiliar settings but I was really surprised by the outcome. ## Introduction {#introduction} If you haven't checked [org-mode](https://orgmode.org/) already, you should. As its main capability it is to keep it simple for writing things down and organizing them, _org-mode_ is great to keep track of the steps taking along the way. The ability to quickly move between _plain text_ and into _code blocks_ is excellent. Coupling _org-mode_ with _[org-babel](https://orgmode.org/worg/org-contrib/babel/intro.html)_ gives you the ability to run the _source code_ blocks and get the output back into the _org_ file itself. That is extremely neat. With those two abilities alone, I could document things as I go along. This included both the commands I am running and the output I got back. **Fantastic**. After some search online, I found out that this method is called _literal coding_. It consists of having the _plain text_ documentation and the _code_ in the same file and with the help of both previously mentioned _emacs_ packages one can get things working. That sounds like fun! ## Emacs Configuration {#emacs-configuration} After digesting all the information I mentioned so far, that got me thinking. What about _emacs_? A quick look online got me the answer. It is possible to do with _emacs_ as well. Alright, let's get right into it shall we ? First step, I added the following line to my _main_ configuration. In my case, my _main_ configuration file is the _doom_ distribution's configuration file. ```emacs-lisp (org-babel-load-file "~/path/to/my/configuration.org") ```
warning
Make sure _org-mode_ and _org-babel_ are both **installed** and **configured** on your system before trying to run `org-babel-load-file`