Almost irrelevant to the story itself, but here's what it feels like to use Emacs these days.
The story talks about monospace fonts and how unappealing they could be for reading prose. It is a fascinating post on itself, but here's what happened - it caught my eye while I was busy, I clicked the link, it opened the page, I kept it hanging around and forgot about it. Then HN page got buried in my browser history. After a while, I found the tab, I read the story and it made me thinking if anyone shared any thoughts on HN. Instead of digging it up from browser history - I ran consult-hn and found the thread - it showed up in an org-mode-derived buffer of hn-reader.el. I was reading through the comments, and I was like: "yah, this probably would be easier and faster to read if I used a different font". I enabled variable-pitch-mode, but it didn't get much better - the default font I set for the face isn't great - I just needed something that existed in both Linux and Mac. I should've picked a better one.
"Let me try a different font", I thought. And how do you change the font family in Emacs? There's probably a way doing it through the UI, but thank you, no thank you - I have a programmable editor. I instinctively opened a scratch buffer and started typing: (set-face-attribute ... And at that point I realized: "Well, this would, a) Change the font everywhere b) What the heck were the parameters for this sucker?".
Of course, why not ask the LLM? I started typing the prompt, right in that buffer. I could've just finish typing and call (gptel-send). But, "what if this becomes a longer chat?". I mean, I still could continue chatting in that buffer, but there are benefits for having specialized gptel buffer, for instance, all my gptel-dedicated buffers get automatically saved. So, instead, I invoked (gptel-inline) - if the answer is short - I'd dismiss the popup and if I have follow-ups, I'll just continue.
LLM told me how to change the font in the current buffer. But I said: "I want to change it for any chosen buffer, since I'd be invoking this from the scratch buffer". At this point I was thinking: "I'm just fooling around, but let's see where it takes me..." It gave me this code snippet.
(with-current-buffer "target-buffer-name"
(setq buffer-face-mode-face '(:family "Georgia" :height 140))
(buffer-face-mode 1))
Since a gptel buffer is just an ordinary buffer, I changed `target-buffer-name` to `
HNComments` and evaled it. The font in the buffer immediately changed. "Meh, I don't like this one, I want to try another...", then I changed the font name.
And at that point, I felt so stupid for wasting my time, I typed: "Can you just build me a consult picker, to select a font for a given buffer with a live preview."
And it just did. ~25 LOC. It took me far longer to write about it, in reality, the transition from a fleeting thought, from a mere idea to a concrete implementation took me seconds. Seconds!
And now I have a command that I can either keep in my scratch buffer, or stick into my config. Or literally just discard until next time I need to temporarily change the font in a given buffer.
Note: this is not a post about "how awesome it is to use AI in Emacs", no. It is all about how enormously flexible Emacs is to bend around to deal with any kind of text.