RSSAmplifier

Blog

Karthinks

Recent content on Karthinks

karthinks.comRSS feed ↗35 posts

Latest posts

Even More Batteries Included with Emacs

Emacs features have a discoverability problem, and we’re chipping away at it one demo at a time. The years since I wrote the last one of these have yielded more surprising and useful finds, so it’s time again for a “batteries included” report. Note This is the third in a series of articles highlighting useful but lesser-known features included in Emacs. Parts 1 & 2:…

Tool use with gptel: looking for testers!

TL;DR: Get LLMs to do things from Emacs, with gptel and your help . A short one today, without the usual flourishes. gptel is a large language model (LLM) client for Emacs. At its core is a wrapper around the HTTP APIs provided by all LLM providers, including the smaller language models you can run locally on your machine. At its surface… well, it tries not to have a surface at all, and…

Fringe Matters: Finding the Right Difference

Continuing my avocation of writing to increasingly niche audiences, today we have a matter at the intersection of several small Venn bubbles: the group of Emacs users who code in Emacs, who use Git (or version control) everywhere, who work using offshoot or feature branches, while using the diff-hl package to visually track changes in their buffers. As minutiae go, this one is quite minute , a…

The Emacs Window Management Almanac

Window management in Emacs gets a bad rap. Some of this is deserved, but mostly this is a consequence of combining a very flexible and granular layout system with rather coarse controls. This leaves the door open to creating and using tools for handling windows that employ and provide better metaphors and affordances. As someone who’s spent an unnecessary amount of time trying different…

For Your Reference: RefTeX in Org Mode

TL;DR: “We have X-references at home” Cross-references in Org mode are not as well developed as its (relatively) new citation system. Org’s built-in linking system is fairly comprehensive and exports to all formats well enough. But if you’re coming to Org from LaTeX, you might prefer something more familiar and oriented towards the label/references mental mapping than the…

Different Strokes For Different Folks

A modest defense of the rodent So, Emacs and the mouse. This is an unexpectedly contentious topic, with discussions that end, at best, with careless dismissal. More often they turn into arguments with folks talking past one another. The advantages of using the mouse for common actions in Emacs are immediate and obvious. Window selection is a natural extension of basic mouse usage. Resizing windows…

Cool your heels, Emacs

TL;DR : Sometimes Emacs needs a timeout A diamond is very pretty. But it is very hard to add to a diamond. A ball of mud is not so pretty. But you can always add more mud to a ball of mud. – Gerald Sussman, paraphrasing Joel Moses A common problem with Emacs’ giant ball of shared state: Any code can step on the feet of any other – including yours. There are conventions in place…

Persistent prefix keymaps in Emacs

Or: Further Musings on the Tedium of Long Key-Chords. In the past I’ve covered various bespoke approaches to the problem of repeating long key sequences: Transient , Hydra , repeat-mode (and repeat-mode’s helpers ) require progressively less forethought and custom elisp chops to set up. Today we continue our aggressive descent into laziness with the simplest way yet to use any Emacs…

A Consistent Structural Editing Interface

Emacs 29 is getting native Tree-Sitter support, and the buzz is hard to miss. Tree-Sitter maintains and provides a concrete parse tree of the buffer that you can query, but that’s as far as it goes. Acting on this information to provide context-aware navigation and editing tools is left to package authors, who have picked up this baton and started running with it! In the last few months…

Notmuch Ado About Nothing

Addressing an innocuous question about the Notmuch email client’s default behavior took me surprisingly deep into the bowels of the package code. When the normal customization methods didn’t help, I realized it might be a good opportunity to live-code a solution. The hope was that it might outline a recipe for reaching into the elisp guts of any library and getting Emacs to do what you…

It Bears Repeating: Emacs 28 & Repeat Mode

Are you tired of pressing C-x o repeatedly to switch to the window you want in Emacs? Or M-g n and M-g p to cycle through compile errors or grep matches? How about navigating outline headings with (yuck) C-c @ C-n and C-c @ C-p ? The correct answer to the latter is that no one traverses headings this way, because these keybindings are atrocious. Even the shorter ones start to grate when you need…

more < less < emacs

If you use Emacs for more than editing text, there are many daily occasions to use Emacs as a pager. Here&rsquo;s my list: Read-only files (with view-mode ) Scrolling through emails ( notmuch ) RSS feed entries ( elfeed ) Reading ebooks ( nov.el ) Web browsing ( eww ) Man pages ( man or woman ) Help buffers and Info documents Git logs ( magit or vc ) System logs, compilation and debug output This…

Fast Latex previews in Org-mode

This is a post in my Latex editing series , a quick package announcement for better Latex previews. After complaining the other day about Latex previews in org-mode being unbearably slow, I decided to take a crack at adapting Org-mode to use AucTeX&rsquo;s preview library, which is blazing fast in comparison: [Fast previews in Org] Direct link to video It was both easier and more annoying than I…

Scaling Latex previews in Emacs

This is a post in my Latex editing series , an awkward solution to a tiny problem. The Problem A common issue with Latex previews in Emacs : The preview images don&rsquo;t scale when you rescale text in latex-mode or org-mode : [VIDEO] Direct link to video This makes it cumbersome to work with Latex math in Emacs when dealing with different sized monitors or when presenting from Emacs with Org…

Dired history in Emacs

Emacs is reasonably consistent across its major-modes in its common usage patterns and keybindings. For example, C-M-a and C-M-e consistently move you to the beginnings and ends of functions in various language modes, and C-c C-z moves the focus to REPLs and back. In read-only modes n and p move the cursor up and down, and w generally copies the path, address or URL of the buffer to the kill ring.…

A Tab Bar Menu in Emacs

One of the first customizations folks make to their Emacs is to hide the menu bar. This makes some sense if you&rsquo;re using a completion UI like Ivy: it&rsquo;s usually faster and more convenient to find an option using fuzzy completion in the minibuffer than it is to mouse over a series of menus. Also, the menu covers only options that are relevant to the end-user. If you want fine-grained…

Simple folding with Hideshow

Emacs has multiple built-in libraries for folding code, as is the case for most things Emacs. The default interface it exposes for folding functions is unwieldy and cumbersome, as is the case for most things Emacs. There is some overlap between Hideshow-mode and Outline-minor-mode. The latter is mainly for folding and navigating nested Org-like headings, but can be extended with the Foldout…

LaTeX Input for Impatient Scholars

Ever since Gilles Castel documented his method for taking math notes in real-time in Vim , I&rsquo;ve noticed Emacs users asking if it&rsquo;s possible to replicate this level of speed and convenience typing \(\LaTeX\) in Emacs 1 . Well, it&rsquo;s Emacs. Of course all of this&ndash;and more&ndash;is possible. I write LaTeX all day, and I&rsquo;m about as fast as when writing equations on paper.…

ELMO - Embark Live Mode for Emacs

Do not use Elmo. Just making a note here. Following the release of mct.el , I packaged some similar code I had lying around to use Embark live collect buffers as an incremental completion system for Emacs. That is, it does roughly the same thing as other completion systems: allow you to select candidates by typing in stuff at the minibuffer. [VIDEO] Elmo is idiosyncratic. It does not show…

An Elisp Editing Tip

One of the first things new Emacs users learn is the eval-last-sexp ( C-x C-e ) command and that Emacs can interpret elisp anywhere it appears. Here&rsquo;s a quick tip about using this command when writing elisp that you may not have discovered. If you call it with a prefix ( C-u ) argument, it prints (or attempts to print) the result in place in the buffer. Better yet, call it with an argument…

Avy can do anything

Update (2024-09-08): Read this article in Japanese at Qiita or at Emacs-JP . You&rsquo;re using Avy wrong. Too harsh? Let me rephrase: you&rsquo;re barely using Avy. Still too broad? Okay, the noninflammatory version: Avy, the Emacs package to jump around the screen, lends itself to efficient composable usage that&rsquo;s obscured by default. Without burying the lede any further, here&rsquo;s a…

Declickbait Elfeed

Using an RSS reader instead of visiting Youtube or other social media has many advantages, including that you have to deal with much less energy-sapping, will-eroding clickbait. Unfortunately feed entries can still have clickbaity titles that can DESTROY your patience! So I wrote a dumb-as-rocks declickbaiter for Elfeed. You WON&rsquo;T BELIEVE the results! The Before (The After will SHOCK you!):…

Popup buffer management with keyboard hints

Just updated Popper for Emacs with hinting in the echo area: When you toggle a popup, popups for the current context are listed in the echo area along with keyboard hints ( M-1 through M-9 by default) to switch to them instantly. The listing is in the order in which the popups are displayed with popper-cycle . Here is a demo of this in action. There is a dispatch feature included that is currently…

Jumping directories in eshell

A quick note that I thought might be interesting to document. As befits a shell written in elisp, eshell is extremely easy to modify to your use. There are a few packages floating around that add autojump/fasd/z type functionality to eshell. These let you jump quickly to any previously visited directory. As it turns out it&rsquo;s very easy to implement a more powerful version of this by…

Fifteen ways to use Embark

Update (2024-10-02): Update for Emacs 29 Update (2024-09-08): Read this article in Japanese at Qiita or at Emacs-JP . Update (2021-10-16): While this list was intended as a demonstration of the kinds of things you can do with Embark, there has been some interest by readers in reproducing these demos exactly on their machines. So I have added a &ldquo;Play by play&rdquo; section under each demo…

A better yank-pop binding

Update (2021-05-18): The inimitable Sacha Chua informs me that the functionality proposed in this post is already included in Emacs 28. If you&rsquo;re using Emacs 27.2 or older, keep reading! Update (2021-05-16): Daniel Mendler, the author of the Consult library, points out that this functionality is also built into Consult as well as Ivy+Counsel. If you&rsquo;re using these, check out…

Bridging Islands in Emacs: re-builder and query-replace-regexp

One of the problems with Emacs, especially out of the box, is that its constituents don&rsquo;t communicate with each other as comprehensively as they ought to. This is expected given the bazaar nature of its development: it&rsquo;s an amalgamation of elisp libraries written by different contributors over decades, few of whom were aware of many of Emacs&rsquo; existing capabilities they could…

Popper-mode: dealing with window clutter in Emacs

Wrote a thing to handle the annoying window flood in Emacs: Popper-mode was brewing for years as part of my config, I decided to bind it into reasonable shape and submit to MELPA. Code , MELPA , Extended demo , Reddit thread

Persistent project switching in Emacs

Just a short note for today, as the super-fast-latex post is still cooking: Emacs provides a few mechanisms to manage buffer/window state as a group. There&rsquo;s current-window-configuration (and its register variants) and desktop-save , and you can act on groups of buffers by every predicate imaginable in ibuffer . But the window configurations vaporize when you shut down Emacs, and they…

More batteries included with emacs

Continuing from last time , here are a dozen more tricks Emacs has up its sleeve that it&rsquo;s shy about telling you. We continue to chip away at Emacs' discoverability problem, one demo at a time. Same rules as before: No packages, stock Emacs only No steep learning curves. Learn each feature in under five minutes or bust . (Up from two minutes last time.) No gimmicks . No doctor, tetris,…

Batteries included with Emacs

Emacs has a reputation for being borderline unusable out of the box, of being bloated but somehow surprisingly bare. This is largely a discoverability problem 1 . The solution the Internet has settled on seems to be &ldquo;Emacs distributions&rdquo; like Doom, Spacemacs or Prelude that glue together dozens (sometimes hundreds) of addons to deliver a batteries included, finely tuned and…

Lazy Elfeed

Elfeed, the feed reader for Emacs, is built on several clever ideas. The basic mode of interaction in Elfeed is through search, specifying what kinds of feeds you want to peruse at the moment. This removes the distinction between an inbox and a search result, which works surprisingly well with the expressive search syntax. The second is integration: search results can be stored as regular…

About

⨕ Grad student in dynamics and control ⨕ Occasional overthinker

The Orphaning of Ideas

Or “A very short investigation of the mental dynamics of feeling suddenly stupid”. Every week I have a couple of experiences that play out as follows: Involved and intricate discussion on non-trivial subject, usually but not always mathematical and/or abstract in nature, involving an attempt to make a deduction about the same, resulting in a sudden and complete blanking of the mind, the contents…

Bodies

I’ve dabbled in mindfulness meditation before, but the past three months have been the first uninterrupted period of sustained practice. While it would be an exaggeration to say I’ve even scratched the surface of the practice, I have learnt a couple of interesting things about the nature of experience. The first is how unbelievably skittish and capricious the mind is: we are all mostly age four,…