Comment by swannodette

1 day ago

  > My experience extending a core emacs function was an instructive and 
  > interesting exercise. I don't know what the future of emacs looks like in an
  > increasingly LLM-crazed world, but I hope that future  includes an open and
  > powerful way to extend and customize the tools we use to write software.

I have gptel configured with Claude 4.1 via API. Claude generates an org-mode file. I ask it questions about Emacs packages, Emacs configuration, and Emacs customization. It responds w/ Elisp snippets that I can eval immediately and see the effect. Claude knows a lot about Emacs. All these chats are version controlled into git so I can easily pull, consult-ripgrep, and pickup where I left off from any of my machines.

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.

I’m always surprised when they (GPT 4.1 in my case) manage to get all of the closing parentheses right! I’d have guessed that having such a sequence of same characters would be a challenge for the LLM to use the right amount

So do you have gptel configured to ask Claude to respond in org-mode? Do you then use elisp to write the chat into a VCS-controlled dir? Do you use org-mode to record the conversation between LLM and user?

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.

  • Yes. gptel supports two output modes out of the box, markdown (meh), and org-mode. I make an org-mode heading with my question, then I press `C-c <enter>`. Claude will use the area bellow the heading for its answer. It will make sub-headings, code blocks, lists, tables, etc. If I have another question then I make a new top level org-mode heading.

    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.

i 100% agree, kinda cool how LISP was first meant for AI and now it’s easy to reap the benefits of this