Some Config Hacks

Bozhidar Batsov has an excellent post that collects several configuration hacks from a variety of people and distributions. It’s a long list and rather than list them all, I’m going to mention just a few that appeal to me. Some of them I’m already using. Other’s I didn’t know about but will probably adopt.

  • Save the clipboard before killing: I’ve been using this for years. What it does is to make sure that the contents of the system clipboard aren’t lost if you do a kill in Emacs. This is much more useful than it sounds, especially if, like me, your do a lot of cutting and pasting from other applications.
  • Save the kill ring across sessions: I’m not sure I’ll adopt this but it’s easy to see how it could be useful.
  • Auto-Chmod spripts: Every time I see this one I resolve to add it to my config but always forget. What it does is automatically make scripts (files beginning with #!) executable when they’re saved.
  • Proportional window resizing: When a window is split, this causes all the windows in the frame to resize proportionally.
  • Faster mark popping. It’s sort of like repeat mode for popping the mark ring. After the first Ctrl+u Ctrl+Space you can continue popping the ring with a simple Ctrl+Space
  • Auto-select Help window: This is my favorite.When I invoke help, I almost always want to interact with the Help buffer if only to quit and delete it with a q. Unfortunately, the Help buffer doesn’t get focus so I have to do a change window to it. This simple configuration gives the Help buffer focus when you open it.

Everybody’s needs and preferences are different, of course, so be sure to take a look at Bastov’s post to see which ones might be helpful to you.

Posted in General | Tagged | Leave a comment

Days Until

Charles Choi recently saw a Mastodon post showing the days until the next election and started wondering how one would compute that with Emacs. He looked into it and, of course, the answer turned out to be simple. Org mode has a function, org-time-stamp-to-now that does exactly that. It takes a date string and calculates the number of days until that date.

Choi wrote an internal function that takes a date string and outputs a string specifying the number of days until that date. The default is x days until <date string> but you can specify a different output string if you like. That function, cc/--days-until, serves as a base for other functions.

Choi shows two such functions. One that allows you to specify a date from a date picker and computes the number of days until that date. The other—following the original question—computers the number of days until the next midterm and general elections in the U.S. for 2006. It’s a simple matter to change it for other election years. Nobody but the terminally politically obsessed would care about that but it’s a nice example of how easy it is to use cc/--days-until to find the number of days until some event.

Finally, in the comments to Choi’s reddit announcement ggxx-sdf notes that you can also use calc-eval for these sorts of calculations.

As Choi says, it’s a human characteristic to want to know how long something is going to take. If you have some event that you want a countdown clock for, take a look at Choi’s post.

Posted in General | Tagged | Leave a comment

Magit Support

Just about everyone agrees that the two Emacs packages considered “killer apps” by those considering adopting the editor are Org mode and Magit. I’ve seen several people say they use Emacs mainly for one or the other.

Their development models are completely different. Org has a development team with a lead developer in much the same way that Emacs does. Magit is basically a one man show, although there are plenty of contributors offering pull requests and even fixing bugs. That one man is Jonas Bernoulli (tarsius) who develops Magit full time and earns his living from doing so.

Like most nerds, he hates marketing and would rather be writing code than seeking funding. Still, that thing about earning a living from Magit means that he must occasionally worry about raising money. Now is one such time. Some of his funding pledges have expired and the weakening U.S. dollar is also contributing to his dwindling income.

Virtually every Emacs user is also a Magit user and many of us depend on it so now would be a propitious moment to chip in some money to keep the good times rolling. The best thing, of course, is to get your employer to make a more robust contribution than would be feasible for an individual developer but even if every developer chips in a few dollars (or whatever) we can support tarsius and allow him to continue working on Magit and its associated packages.

His support page is here. Please consider contributing a few dollars. Tarsius certainly deserves it and we’ll be getting our money’s worth.

Posted in General | Tagged , | Leave a comment

🥩 Red Meat Friday: Rules For Lisp Programs

Over at tfeb.org there’s an amusing post on rules for Lisp programs. The rules boil down to:

  • Write only in Lisp
  • Don’t use Lisp OOP constructs
  • Don’t use the Loop macro
  • Avoid package-qualified names

The list is obviously meant to be humor but the thing is, I agree with them all. You don’t really need OOP in Lisp and—sorry true believers—the Loop macro is an abomination that doesn’t belong in Lisp.

Folks over at the Lisp subreddit are not amused. Some are even taking the list at face value, but each item in the list is really a matter of opinion. That’s what makes it so perfect for Red Meat Friday.

Of course, this is Red Meat Friday so we’re all just having fun. Right?

Posted in General | Tagged , | Leave a comment

Voyager 1

About 50 years ago some engineers at JPL were building a space vehicle with the Star Trek-like 5 year mission to go to unvisited places and seek out new knowledge. That vehicle was, of course, Voyager 1 and the unvisited places were Jupiter, Saturn, and their moons.

But so much more happened. Instead of a five year mission, Voyager 1 is still operating, has left the solar system, and is sending back data from 15 billion miles away. No other man made object has traveled so far from Earth.

Tech Fixated has a nice story about Voyager 1 and its mission. The first thing to remember is that it was built with 1970s technology. It has an extraordinarily small working memory of 69 KB and uses an 8 track tape recorder as it’s backup store.

That “8 track recorder” was not what you’re probably thinking. It was a specially built machine with 1,076 feet of tape specially designed to withstand the rigors of space. It was so well built that it didn’t have a single failure during its lifetime. In 2007 it was shutdown to save power because of the dwindling power coming from Voyager’s radioisotope thermal generators.

Its radio transmitter uses about the same power as a refrigerator light bulb but is still managing to send data from 15 billion miles away. The one-way trip takes 23 hours. That came into play when the thrusters that keep Voyager’s antenna pointing at Earth went off line. The engineers figured out a possible fix. If they were wrong, Voyager would be destroyed but they sent the command anyway. Once sent, it would take almost 2 days to learn if it worked. It did work and Voyager continues sending priceless data that is available nowhere else.

Tech Fixated’s article has a lot more details. If you’re a nerd, you really should read it. It describes an amazing piece of engineering

Posted in General | Tagged | Leave a comment

Tolerance For Repetition

Floofcode over that the Emacs subreddit asks a question that resonates with me. He notes that he often has a repetitive task and wonders whether it would be worthwhile writing some Elisp to automate it. Usually, he has to repeat the task several times before he gets fed up and fixes it for good. He wonders how other people deal with this. Do they have to repeat the task a certain number of times before automating it or is the criterion more subjective.

I can relate. This happens to me all the time. I keep doing the same task over and over until one day I realize that I’m being stupid and spend a few minutes dashing off a bit of Elisp that solves the problem once and for all. Every time, I tell myself, “Well, I won’t that mistake again. Next time I’m going to get this type of task automated right away.” Of course, the next time the same thing happens.

As to floofcode’s question, I would guess that it depends on the person. For me, it’s a subjective matter. The amount of time I’ll spend repeating the same boring task over and over varies but it always ends in a fit of anger when I ask myself why I’m still doing things manually. The thing is, when I’m repeatedly doing the task manually, I’m not wondering whether I should automate it. That happens at the end when I realize I’ve been stupid.

I guess the answer is something of the sort that after you’ve repeated the task twice, just automate it. Sure sometimes you’ll lose and waste time but in my experience it will most often be a win. I wish I could learn this.

Posted in General | Tagged | Leave a comment

Karthik On Repeat Mode

The other day, I wrote about repeat mode. My take was that it was a way repeating certain commands without having to retype their, possibly, complex prefixes. All of that is true but as Karthik informed me in a comment, there is much, much more to repeat mode than simply repeating commands.

It is a way, he says, of grouping a set of related commands together into a sort of mode. Thus, there is more to Ctrl+x } than simply repeating the enlarge window command. Once you type Ctrl+x you can type any of {, }, ^, v to resize the window in any direction. The Ctrl+x enables a keymap with those four single keys to resize the current window, defining, in effect, a “resize window mode”.

Four years ago, Karthik wrote a long post that explains all this and, at least on an intuitive level, how it works. My first thought was to add an update to my post that pointed to Karthik’s and I did that but then I thought that his post was so good that I should devote a new post to it so that anyone who missed it the first time would see it.

Repeat mode really is an excellent facility—Karthik says it’s a cornerstone of his Emacs usage—and every Emacser should be familiar with it. If nothing else, it’s worth enabling repeat mode so that you can use the built in repeat maps. You can see what they are by running the command describe-repeat-maps.

Posted in General | Tagged | Leave a comment

Read Extended Command Predicate

Bozhidar Batsov has a post that mentions how M-x shows a lot of commands many of which make no sense in the current context. This has never bothered me because after inputting a few (fuzzy) letters, the display converges on the command I’m looking for. Others, are not so sanguine and find the long list annoying.

It turns out that there’s an easy fix for this: read-extended-command-predicate. As of Emacs 28, You can set this variable to one of 3 values—or nil​—to control the filtering of commands in the candidate list. These are:

command-completion-default-include-p
Exclude on those commands tagged for a different mode.
command-completion-using-modes-and-keymaps-p
Include only commands tagged for the current buffer and those commands that have a keybinding active in the current buffer.
command-completion-using-modes-p
Show only commands tagged for the current mode.

The first option is the most conservative and general and is what Batsov recommends for everyday use.

Batsov also explains how functions can declare what mode or modes they’re appropriate for. That’s simply a matter of listing them in the interactive declaration. There are a lot more details in Batsov’s post so be sure to take a look. The read-extended-command-predicate mechanism is similar to the execute-extended-command-for-buffer mechanism that I wrote about previously.

As I said, the long list doesn’t bother me but if it annoys you, this may be the answer.

Update [2026-04-07 Tue 12:05]: prefix → predicate

Posted in General | Tagged | Leave a comment

Repeat Mode

As many you know, I was a Vim user for a couple of decades before I found the one true editor. One of the things I miss from Vim is the easy to use repeat command. If you’re in command mode and perform some command, you can repeat that command by simply pressing .. Sadly, Emacs doesn’t have anything similar. There are a couple of repeat commands: one for simple commands and another for “complex” commands but I was never able to internalize them.

Happily, there is repeat mode that allows you to repeat a command by omitting the prefix and pressing the last key. For example, if you want to repeat the command to enlarge a window horizontally (Ctrl+x }) you can simply repeat the } as many times as needed.

As Bozhidar Batsov explains, this doesn’t work with every key sequence but it is easy to add the functionality to multikey sequences. The TL;DR is that you have to provide a special keymap that maps the last key(s) to their action(s). Batsov has a worked example to show you how to do it. It’s not very hard. But, it turns out, it can be even easier. Omar Antolín explains in a comment that there is also a macro, defvar-keymap that abstracts all the boilerplate away and makes it really easy to define and install a new repeat map.

Repeat mode still isn’t as nice as Vim’s repeat but it can reduce the friction of repeating certain commands. Take a look at Batsov’s post for the details.

Update [2026-04-06 Mon 11:05]:

Karthik Chikmagalur has an excellent write-up on repeat mode that shows it’s useful for much more than simply repeating a command. See his comment below.

Posted in General | Tagged | Leave a comment

Congratulations Álvaro

Irreal readers can’t help but know who Álvaro Ramírez is, if for no other reason that I’m always blathering on about his Journelly app that is my most used and useful iOS app. But of course, Ramírez has many other excellent apps, many of which are Emacs packages. In particular, there is his dwim-shell-command that allows you to automate shell commands—particularly those with complex invocations—from the comfort of Emacs. There’s also his take on music players, an uniform AI access app, and a lot more besides.

You can check out his blog posts or take a look at his iOS/macOS/Emacs applications. He’s been an independent developer for some time but now he’s taken on a new role: fatherhood. He’s now the proud dad of a new son. He tells us that his output may slow down a bit because, after all, he has to start working on his son’s init.el.

Posted in General | Tagged | Leave a comment