ketan agrawal

♏️ emacs
Last modified on May 16, 2022

I started using Emacs in January 2020, and it has undoubtedly changed the way I do work on my computer, and the way I think about computing in general.

Things I really like about emacs

Emacs enables a personal framework of experimentation.

It’s completely hackable, which easily leads to an “experimental” mindset. I feel like people don’t really try tweaking the default settings of things in important ways. Granted, you can get lost in customization, and tweaking every little aesthetic and all that…but I believe that there have been several important ways that I’ve been able to customize my workflow due to Emacs and the OSS that has built many different extensions for it.

Cool configs

justinekizhak

I like the motivation he gives for why emacs is so powerful. “Emacs changes how you think about programming.” I feel like this has been very true for me. It makes many other applications seem needlessly restrictive. It feels natural to have the entire OS be an introspectable operating system.

skills I am learning

become a master of debugging in emacs

Something crashing? Use Edebug to debug it. Something slow? You can easily profile it.

lisp macros

Really powerful feature that allows one to define domain-specific syntax within Emacs Lisp. Examples I really like include org-ql, rx notation, and so many more that enable someone to write expressive, parsimonious code in a bottom-up fashion.

Links to “♏️ emacs”

org-mode

An integral part of emacs .

cool things

Idk I think this is just gonna be a connector node for now??

♏️ emacs

humor

what is humor? things that are unexpected, but in a “humorous” way? Ok, that’s tautological. But still. definitely something that I want to think about, notes I’m actively working on.

As a kind of meta example, while I’m here writing this note in emacs, I found myself naturally laughing at the fact that org-mode interpets the + signs in the encrypted PGP message in my org-journal files as a strikethrough, so parts of the PGP message are struck through. Even though strikethrough and org-crypt are both bona fide features of org, no one really noticed this little harmless, unintended interaction between the two (huh, there’s the connection to modularity!). Lmao.

screenshot of an encrypted journal file, displayed the aforementioned striking-out behavior within the PGP text. Hey, if you figure out how to decrypt it, you can read my journal file for the day!

Figure 1: Hey, if you figure out how to decrypt it, you can read what secrets I told to my journal today!

modularity

I think it can be really good. Fairly related to compositionality. Will have to hash out what I think the difference is there.

♏️ emacs gets a lot of its power from its modularity. Packages are just little pieces of code– you can add/remove them into your ecosystem as you please. As opposed to proprietary software, where you may be much more limited in the customization that you can do…one piece of functionality for Evernote might not carry over to VSCode might not carry over to your web browser. etc.

^it’s beautiful chaos sometimes, though! Modules designed by tens of thousands of independent humans are bound to be overlapping, redundant, and sometimes confusing to “glue together”…

Despite reading explanations and guides occasionally, I’ve never understood how Org, BibTeX, org-ref, ebib, etc. all work together. I once tried to set them up using BibTeX references in a file, but I wasn’t able to figure out how to get citations working. I ran out of time to fiddle with it and had to do all the citations manually. :(

Well… They do not. It’s up to the end users glue them together. Bib(La)TeX only take care of record books&c references in a textual flat-file database, org-ref is mostly a helper to add things to that text db and quickly link a record in an org documents, helm-bibtex or ivy-bibtex are the search-based UI to operate with.

But luckily emacs has a great community that has helped smooth out the rough edges between packages, and even make them work together to make emacs a better place.

But….is the brain modular? I think it might not quite work that way.

Programming Bottom-Up

http://www.paulgraham.com/progbot.html

There are two ways of programming in Lisp – top-down, and bottom-up.

Top-down = the classic paradigm of divide-and conquer, decomposing the problem hierarchically into smaller problems.

Bottom-up = defining your own DSL in Lisp, and using those primitives to make something cool.

Most programming is done top-down, but with the powers of macros you can go bottom-up, creating “little universes” in Lisp…

Personally what comes to mind is the rx macro in emacs. It’s like a nice little domain-specific language for writing regular expressions, embedded right into elisp.

Regexp matching a block comment in C:

(rx "/*"                          ; Initial /*
    (zero-or-more
     (or (not (any "*"))          ;  Either non-*,
         (seq "*"                 ;  or * followed by
              (not (any "/")))))  ;  non-/
    (one-or-more "*")             ; At least one star,
    "/")                          ; and the final /
/\*\(?:[^*]\|\*[^/]\)*\*+/

Personally, I find this to be a much more beautiful (and still somewhat succinct) way of writing regexes than the normal regex syntax.

you redefine the language itself to have the primitives you want it to have, and then you can proceed to build something (perhaps in top-down fashion now.) It’s like “meeting in the middle,” so you don’t have to build up super complex primitives, and you don’t have to decompose down to a super fine-grained level.

I wonder what the connection between this bottom-up paradigm and Bret Victor - The Future of Programming is. I feel like maybe there’s an idea that his visual programming playgrounds are like a domain-specific language (albeit not in Lisp.) They give the user a powerful set of primitives to manipulate digital objects, and the user can then build from there to make it come to life.

Also feel like emacs encourages bottom-up programming in some ways, well ofc because of Lisp, but also because of the interactivity of the environment. You write a snippet, and immediately you can evaluate that code and test out your snippet. You get a couple more snippets, try those out, and then it’s like, ok cool, what else can I build with these snippets?