Emacs

tags
Computer Text

"Any sufficiently advanced hobby is indistinguishable from work."
Jeremy Friesen

Emacs is a Lisp interpreter nailed to a text renderer nailed to X.

Emacs is probably the oldest piece of software I use directly (developed beginning in 1972). Most everything annoying about it is explained by that fact.

Compiling

I want the following build flags:

--with-libsystemd
--with-modules
--with-native-compilation=aot
--with-tree-sitter
--with-xml2
--with-x-toolkit=lucid

Unfortunately, such a build is not available in any convenient repo (Arch/AUR/nixpkgs). nixpkgs does seem to build with --with-xinput2 but nevertheless lacks XInput2 support (missing libXi.dev build dep?), so no dice for pixel-scroll-precision-mode. Currently using a custom build mostly based on core/emacs and aur/emacs-lucid. Just do the usual AUR makepkg && pacman -U <pkg> thing.

I thought --with-xml2 might fix a problem I was having with BibTeX parsing. No dice but I guess it's a bit faster, so I kept it.

Resources

Emacs Docs
Productive Emacs
Demystifying Emacs's Window Manager - Mastering Emacs
The Emacs Window Management Almanac | Karthinks
Emacs: use-package essentials | Protesilaos Stavrou
Emacs China seems to be thriving

Elisp

Reference manual
Emacs In a Box
How do I use nadvice?
while-no-input is an interesting async mechanism, used by completion frameworks to do heavy stuff without blocking
Elisp sucks (and can we make it suck less?)

Data structures

Most basic is the list, a nil-terminated linked list.
Vector: Fixed array of objects, e.g. [a 1 "hello"]. Vectors are self-evaluating, which gives them some nice constant properties.
Association list: A list of cons cells, e.g. '((name . "Will") (cool . yes)). You can push a new cell to override an existing one, which can be useful for customizations - AFAICT this is the main reason to use alists, and the usual place you see them is in customizable variables. You can also modify an alist with setf.
Property list: A list of alternating keys and values, e.g. '(name "Will" cool yes). Like an alist without the cons cells. They're used for e.g. text properties and symbol properties, in which contexts the manual claims they have some performance advantages, but not in a way that makes any sense to me. I suspect the elisp plist is just an accident of history.
Hash table: They aren't used as much as I'd expect.

Libraries

Sequences: Prefer the built-in seq.el (seq.el vs. other libraries through hundreds of examples). dash.el is fine too when you need something more. Elisp collection primitives are extremely confusing and best avoided.
Strings: s.el is good. Built-in subr-x.el has some common string manips (join, blank-p, remove-{pre,suf}fix, limit, pad) and some interesting DWIMish ones (limit, pixel-width, glyph-split)

Dot notation

Dotted pair notation, e.g. (a . b), is “a general syntax for cons cells that represents the CAR and CDR explicitly.” (manual)
It's useful for creating lists that are not nil-terminated. '(1 2) gives you a nil-terminated linked list, i.e. '(1 . (2 . nil)). Sometimes you want '(1 . 2) instead. The most salient example is that this is how association lists work: an alist is a list of cons cells.

Completion

Builtins: completing-read uses the minibuffer to prompt for something, and maybe suggest completions. completion-at-point provides completions in situ, by default in a separate *Completions* buffer, but there are many packages that provide nice popups at point instead.
completion-at-point-functions (CAPF) is the builtin mechanism for finding completion candidates.
Vertico is a simple minibuffer completion UI.
Corfu is an in-buffer completion UI based on CAPF. It's just a frontend, but there's also Cape, which does provide some CAPFs.
Company (COMPlete ANYthing) is a popular “modular text completion framework” from the days before CAPF. It provides both completion backends (for finding candidates, like capf) and frontends for in-buffer completion. I use Corfu instead, but Cape provides cape-company-to-capf to convert (very widespread) Company backends.

Try someday

Verb: HTTP requests via Org

mickeynp/combobulate: Structured Editing and Navigation in Emacs with Tree-Sitter

akib/emacs-eat: Emulate A Terminal, in a region, in a buffer and in Eshell

Meow: eshan ramesh

jdtsmith/ultra-scroll: Like pixel-scroll-precision-mode, but purports to handle tall images better

protesilaos/sxhkdrc-mode: Emacs major mode for editing sxhkdrc files (Simple X Hot Key Daemon)

steveyegge/efrit: A native elisp coding agent running in Emacs

Elfeed with Tiny Tiny RSS (mirror Elfeed to wohanley.com)

karthink/elfeed-tube: Youtube integration for Elfeed, the feed reader for Emacs

HTML email composition: Emacs for email: HTML and replies | John’s web site

dschoepe/notmuch-snooze: Support for snoozing messages in the notmuch mail client

Org Edna: Extensible Dependencies ’N’ Actions for Org Mode tasks

GitHub - ichernyshovvv/org-timeblock: Schedule your day visually, using timeblocking technique inside Emacs

hole mode for emacs

Display list of org-attach’ed files in buffer property

Hyperbole

Cool stuff

tbanel/uniline: easily draw UNICODE lines and boxes
alphapapa/org-ql: An Org-mode query language, including search commands and saved views
Organice: org-mode without Emacs. Can use as progressive web app on mobile browsers
point-stack.el