4 ms·
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 co
by iLemming 1mo ago
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.
- citizen428 1mo agoThis is why so many of us are so much into Emacs. In a time where pretty much all software around us gets progressively enshittified, there’s this 50 year old Lisp interpreter masquerading as an editor that you can make truly and uniquely yours.
- iLemming 1mo agoYup. Watching so many of my peers struggle with some basic tasks like grabbing a url and inserting it into a chat buffer. I mean, come on. How many times a day you do this? And you just settled with always: - going back to the browser - clicking on address bar - attempting to select the link with the mouse - switching back to wherever you want the link - inserting it - realizing that you missed a character - mouse is imprecise for text selection - repeating the process - Oh shoot. It's a markdown, I need now to grab the description of the page too. And... back to the dance again. Shit like this, for me is just pressing a key. And it nicely formats it (for whatever markup you want), grabbing the correct description, etc. I solved the problem once, and it just works and I never have to ever spare a split second neural signalling for it - there's no attention tax. I'm forever indebted to my younger self for convincing and forcing myself to learn Lisp and spend some time understanding Emacs. Among all sorts of skills that I picked up during my tenure - CLIs, Unix, Linux internals, networking, git fundamentals, vim, various programming languages, front-end, devops, cybersec, etc. etc. - Lisp remains enormously practical, the best skill that I'm so glad I acquired.