A Beginner's Guide to Extending Emacs
Posted4 months agoActive4 months ago
blog.tjll.netTechstory
calmpositive
Debate
20/100
EmacsCustomizationProgramming
Key topics
Emacs
Customization
Programming
The article provides a beginner's guide to extending Emacs, sparking a discussion on the editor's customizability and its potential future in an AI-driven world.
Snapshot generated from the HN discussion
Discussion Activity
Moderate engagementFirst comment
1h
Peak period
7
2-4h
Avg / period
2.8
Comment distribution14 data points
Loading chart...
Based on 14 loaded comments
Key moments
- 01Story posted
Sep 12, 2025 at 11:32 AM EDT
4 months ago
Step 01 - 02First comment
Sep 12, 2025 at 12:42 PM EDT
1h after posting
Step 02 - 03Peak activity
7 comments in 2-4h
Hottest window of the conversation
Step 03 - 04Latest activity
Sep 13, 2025 at 7:35 AM EDT
4 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45223239Type: storyLast synced: 11/20/2025, 12:53:43 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
Prot has an intro book on elisp[1] which I want to go through, because some specifics of text processing and buffer usage are a bit unique - it is a lisp for a text editor, after all! But it is still just a lisp, and it even has a lot of common lisp functions in cl-* namespace!
[1] https://protesilaos.com/emacs/emacs-lisp-elements
if you test it and it works, you should publish it.
- `info` lets you read the emacs manual
- `apropos` lets you search for various elisp symbols in the editor, so if you're looking for something vaguer than a direct function or command you can search via apropos.
- The in-built `describe` (though I use a fantastic package called `helpful`) lets you figure out what the definition of a given variable, function, or command is. You can even look at what command a given key binding calls.
- Claude does a great job at teaching details of the editing/programming model of emacs which helps if you'd rather not read through the entire emacs manual
Things like this make emacs a joy to hack on (until you're trying to debug some slightly annoying behavior or crufty event loop thing ;)
What do you mean by this? One can look at Emacs itself as a crusty event loop with some slightly annoying behavior. But seriously, I am curious what you mean.
You may already know (and others may not):
- `M-x toggle-debug-on-error` throws you into the debugger on any error (note this isn't "visual" the edebugger!). Use C-h m to see the navigation commands/keys
- Use (debug) to set a breakpoint in Lisp code
- depending on the circumstances, the edebugger may be more helpful. I always instrument the function to debug with `C-u C-M-x` from within the function's form and use `C-M-x` to interpret it (sorry, I forget the underlying commands)
Of course, there's great documentation for both the debugger and edebugger.
I can add my `.emacs` to the Claude context to get more precise answers. If it falls over on some package I can `M-x find-library` to add that library's source to the context. If the code it wrote doesn't work, I add the `Messages` buffer and the `Backtrace` buffer for errors. I eval the snippet, reprompt, rinse and repeat.
With this fast feedback loop (no restarting Emacs, just live coding), I've added a ton of customizations that in my twenty years of using Emacs previously just never felt like I had the time or enthusiasm for given higher priorities:
* Boring stuff: managing where modes open buffers in which windows
* More ambitious stuff: standard org-remark behavior isn't that natural for highlighting and making notes so I made a nicer Transient based thing for it.
* Stuff for work: a fast logging minor mode that font locks incrementally, disables all the save prompting, and handles ASCII color codes. Later I intend to linkify stack traces, linkify data so that they open pretty printed in a different buffer, collect errors and show an unobtrusive notification in the active window, etc. etc.
In two weeks, I've learned more Emacs than I did the 10 years prior. Most of all, this is a usage of LLMs that I can say I honestly love - improving my own day-to-day tools. Because Emacs is a text-oriented live programming environment - LLM integration just feels like it's on a completely different level.
Claude (or any good LLM) + Emacs is a killer app.
Curious because I've been thinking of writing a chat mode based on gptel to more closely mimic the behavior of Claude Desktop. I find the vanilla gptel experience to be pretty bleh but I know it's meant to be extensible and not necessarily a user-facing experience.
I started doing this because I got fed-up with Claude Desktop for my StackOverflow style programming questions - and then stumbled upon using it to configure Emacs.
[a] A simple tip. You can find the function of a key sequence with this sequence: `C-h k <sequence>`. Try this with any regular letter key to see what the parent comment is talking about.
3 more comments available on Hacker News