Transient Mark Mode

If you’ve been an Emacs user for a while, you probably know what transient mark mode is and you might even know that its use is—or was—controversial. It used to be disabled by default but in Emacs 23 the default was changed to enabled. I’ve never understood the controversy. Why wouldn’t you want the active region to be highlighted? I started with Emacs 21 and one of the first things I did was enable it. In fact, I just checked and it’s still in my init.el. After almost a decade and a half of Emacs use, I still didn’t understand the controversy. Until today.

Wilfred Hughes just tweeted a link to a post by Sean Whitton that explains the transient mark mode controversy and gives some mitigations. There are two problems with transient mark mode:

  1. If you want to just set the mark (to jump back to it later, for example) you have to type Ctrl+Space Ctrl+Space instead of just Ctrl+Space to set the mark without activating it.
  2. When you use Ctrl+x Ctrl+x to switch the mark and point, it activates the region between them and you have to either precede the sequence with a Ctrl+u or follow it with a Ctrl+g to avoid the highlighting.

The first isn’t much of a problem. Especially for me since I don’t set the mark manually very often. The second is a little more annoying but is hardly a deal breaker. In any event, Whitton gives a bit of Elisp to inactivate the mark after the switch so that the region doesn’t get highlighted.

There are some benefits to transient mark mode other than highlighting the region that you can read about in Whitton’s post. He provides another bit of Elisp the provides those advantages without having to have transient mark mode enabled. He says that he has been running with the second—but not the first—fix enabled and transient mark mode disabled and found that he didn’t mind not seeing the active region highlighted.

That strikes me like living without air conditioning. Sure, you can do it but why? Whitton’s post made me think that I made the right decision in enabling transient mark mode all those years ago but your mileage may vary. Read Whitton’s post and make up your own mind. At least you’ll know what the controversy is about.

This entry was posted in General and tagged . Bookmark the permalink.