The Arcology Garden

Why rrix Uses Emacs

LifeTechEmacsArcology

This is an exploration of why I use Emacs, and the tools I choose to use within Emacs. I work in a collaborative environment across two or more engineering offices, and pair program with colleagues both local and remote as a tool for problem solving and mentorship.

Naturally, conversation comes up around my computing systems, and this presentation is meant to be a distillation of the philosophy behind it.

This is intended to be a live presentation, roughly 45 minutes in length, with live demonstrations of the concepts and applications which are referenced, presented in the context of a team brownbag session. I probably over-prepared for it, and may pilot this to a wider audience or as long-form narrative.

It's provided in outline form for reference and for those with a vivid imagination and is viewable on the World Wide Web largely as a courtesy.

Prior art:

What is Emacs?

Emacs is a text editor. You can open a file, and modify it, and save it for use in other systems.

Emacs is a 40 year old piece of software. Emacs predates the Common User Access paradigms that personal computers made common.

Emacs is a software lisp machine. A simple C core interfaces with the OS and window manager, a simple Scheme-like language interfaces with the user.

Emacs is an application environment whose APIs are built around transforming text and data.

Emacs is a word processor, a mail client, a todo-list, a chat client, an integrated development environment, a desktop window manager, a web browser ...

Emacs is The most successful malleable system in history .

Why Emacs? (1)

Let's start with some code, shall we?

emacs-lisp source: :results none
(load-theme 'doom-nord-light) (setq-local mode-line-format nil) ; disable status line in this buffer (setq org-present-text-scale 3.5) ;; Change font size on starting up `org-present' (add-hook 'org-present-mode-hook (lambda () (org-present-big) (org-present-read-only))) (add-hook 'org-present-mode-quit-hook (lambda () (org-present-small) (org-present-read-write))) ;; Set some movement keybindings (evil-define-key 'normal org-present-mode-keymap (kbd "n") #'org-present-next) (evil-define-key 'normal org-present-mode-keymap (kbd "p") #'org-present-prev) ;; Jump to this buffer with <SPC>j in `evil-normal-state' (add-to-list 'same-window-buffer-names "emacs-lnl.org") (evil-leader/set-key (kbd "j") (lambda() (interactive) (display-buffer "emacs-lnl.org")))

This block of code, and blocks like it, are 90% of what's drawn me to Emacs . Allow me to explain.

Why Emacs? (2)

Delivers what I want:

  • Self-Consistency

  • Programmability

  • Integration

  • "Killer Apps"

Self-Consistency

  • Nearly everything in Emacs is programmed in a single language, Emacs-Lisp

    • Single-threaded (now with cooperative multitasking yield/await style)

    • "Blocking" usually done using out-of-Emacs processes with input/output treated as buffers of text

    • Emacs Lisp is not "purely functional", it's a procedural, interactive language with support for some common-lisp idioms and lisp-y data structures.

    • Relatively stable, code from 10 or 20 years ago still runs.

  • (find-library "subr.el")

  • (find-library "cce/org-mode")

  • C-h f gives you documentation on any function in Emacs

    • Similar for variables, key bindings, modes

    • In-line help browser (info "magit")

  • Emacs is "modal" like Vim and Blender, this doesn't inhibit consistency but enhances it

    • Each buffer has a single "major mode", and many "minor modes", some global, some local.

Programmability

  • If everything including configuration is written in a single language, everything can be programmed.

  • Full "applications" can be built

  • Emacs Lisp was designed mostly to transform text.

    • As a user you can use this to your advantage.

    • Keyboard macros can become code

    • Code can be trivially bound to keys

Integration

If everything is text, and everything is consistent, and everything is programmable, then everything can be integrated.

I can, if I choose:

  • Read my inbox in Gnus

  • "Capture" emails that I need to review or respond to in to my todo list

    • Prioritize it at capture time or at organizational time

  • I can do most of the work that goes in to an email response in org-mode

  • Export the org-mode listings to text or HTML and embed it in the email response

What are the "killer apps"

  • Magit -- full-featured "git porcelain"

    • (magit-status (expand-file-name "~/Code/AFDSEW"))

  • org-mode -- An outlining tool, but actually so much more

    • Task + Agenda + Time tracking (org-agenda nil "a")

    • "Literate Programming" (find-file "~/org/paper_js.org")

    • Outline -> Document -> Publish -> Program

    • Spaced repetition flash cards with scores and reminders on agenda (find-file "~/org/japanese.org")

    • This guy runs a bakery on Org-mode and Postgres.

  • Gnus -- It's a usenet client, but also an IMAP client. Tonnes of features, bit of a weird UX since it's fundamentally a usenet client. Gnus has some killer apps itself:

    • Adaptive mail sorting based on your own reading habits + scoring rules

    • Virtual folders (based on rules, or just coalescing multiple folders in to one)

  • Hydra allows you to easily define a set of key bindings that can be executed from a common prefix, and chained together

  • evil-mode -- vim bindings, but everywhere

  • exwm -- Your windows are "just" emacs buffers

    • automate browser + GUI activities with Emacs macros + Lisp

  • company-mode -- Consistent autocompletion framework

    • (progn (org-present-read-write) (company-emoji-init) (company-mode)) :laugh

  • M-x tetris and other games built in.

  • The Emacs Web Wowser (EWW, for short) (eww "https://privacy.uber.com/policy")

Where does it fall short?

  • Out of the Box, it leaves much to be desired.

  • Integration with collaborative tools

    • No phabricator or Asana sync for org-mode

    • Confluence/Portal of the Week

    • Google Docs + collaborative stuff largely nonexistent

  • No one else uses it.

  • Mobile story basically nonexistent

    • Org-mode has some apps that get nearly close to Okay

    • Orgzly on Android, beorg on iOS

  • It can all feel a little "rube goldberg" brittle at times

    • Heavy reliance on external tooling makes fast-moving languages like Golang tough to keep up with

  • If everyone can find their own local maxima, consistency of environments is a Hard Problem

Questions/Comments

Where can you start?

To quote the Gnus Manual:

You know that Gnus gives you all the opportunity you'd ever want for shooting yourself in the foot. Some people call it flexibility. Gnus is also customizable to a great extent, which means that the user has a say on how Gnus behaves. Other newsreaders might unconditionally shoot you in your foot, but with Gnus, you have a choice!

Malleable Systems like Emacs provide the technically engaged end-user with a nearly endless arsenal of tools, and infinite ways to combine those tools. Emacs is not a tool so much as an workshop of ideas, a set of tools to design the ideal workshop.