The simple pleasure of deleting code (in this case, from my init file)

Published 2026-10-02

tag(s): #overblown-minor-annoyances #emacs

Emacs 31 includes a bunch of new window management commands. A few days ago I transposed two windows, and randomly remembered this, so I opened the NEWS[1] file and searched for "transpose".


*** New commands to modify window layouts of frames.
'window-layout-rotate-clockwise' ('C-x w r <RIGHT>') and its counterpart
'window-layout-rotate-anticlockwise' ('C-x w r <LEFT>') rotate an entire
window layout.
'window-layout-flip-topdown' ('C-x w f <DOWN>', 'C-x w f <UP>') and
'window-layout-flip-leftright' ('C-x w f <LEFT>', 'C-x w f <RIGHT>')
flip the window layout vertically and horizontally.
'window-layout-transpose' ('C-x w t') reorganizes windows such that
every horizontal split becomes a vertical split and vice versa.
'rotate-windows' ('C-x w o <RIGHT>') and its counterpart
'rotate-windows-back' ('C-x w o <LEFT>') rotate windows in cyclic
ordering.
    

By the way, when you read NEWS in Emacs, each function is highlighted, and you can navigate to their definition. How cool is that.
Anyway, window-layout-transpose is what I want, and it replaces the third or fourth version of such command in my configuration. The next decision is whether I keep my current binding C-x |[2], or go for the default C-x w t.

On the one hand, the default is long-ish. But this isn't something I need that often, really. And getting used to the new C-x w prefix is a good idea, although I have looooong ago given up on the idea of spending too much managing window layouts in Emacs. I usually have one or two open, and if I need to look at something else I just pop a new frame.

Revisiting other customizations

I also had a pair of custom commands to split windows and "select" the new one (which means, move "point" to it (which means, move the cursor to it)).[2]
Since the day I started drafting this post, when I removed those functions, I have adjusted to the default behaviour. The difference? My eyes (and attention) used to jump to the newly created window, and now stay on the current one. I can't say that one way of doings things or the other is better. Honestly, this is a really small difference.

What I can say is that the change reflects my new attitude to trying to accept more the Emacs defaults and give them an honest try.
Yes, you can configure and change every single thing in the editor, and this is one of its strengths. But you can also try how it works out of the box and be pleasantly surprised that the way things are makes more sense than it seems on the surface. Or, like in this case, that it doesn't really matter, so I get to remove a few lines.

That's all

In case you are curious, you can see the deleted code in my dotfiles repo.

Footnotes
  1. C-h n opens the file in Emacs itself. Because of course you can read it direcly from Emacs. You can even use a numeric argument to read the release notes for that version number.
  2. That's a lot of Emacs lingo, ain't it?

Share your thoughts (via email)

Back to top

Back to homepage