Endless Parentheses

Concise ramblings on Emacs productivity.

New in Emacs 25.1: Query-replace history is enhanced.

Since the previous post on Emacs 25 has been well received, I've decided to start a series on the topic. It's time to get off the rocking chair, step off the porch and onto the sidewalk, and start walking towards that ominous “25” on the horizon. Unlike the birthday post, we're not here to discuss possibilities, but to meet and greet every new feature that's already implemented in Emacs master.

This time, we stick to the style of the blog. Short posts listing a single feature, or two at most. It's going to be a long walk, so we might as well take it one step at a time.

When [in] query-replace […], typing M-p will now show previous replacements as "FROM SEP TO", where FROM and TO are the original text and its replacement, and SEP is an arrow string defined by the new variable query-replace-from-to-separator. […]

This is actually rather cute.
query-replace-prompt.png

The arrow is intangible, so it really doesn't get in the way. You can edit either sides of the prompt, switch them around for a kind of “undo” effect, and you can even delete the arrow to turn the prompt into a regular FROM prompt.

If you keep cycling back through all the previous replacements, you will eventually be offered replacements in the old format (just TO and then just FROM).

Tags: query-replace, emacs-25, emacs

Say thanks on Gratipay
comments powered by Disqus