Preview Mass Text Replacements with Emacs 30.1 replace-regexp-as-diff

Teaser image

Using regular expressions to perform text replacements can be tricky. Without robust undo support or version control, a preview of the changes, or checking every replacement before it’s being made, you can end up with false-positive matches and mess things up. Now Emacs 30.1 released and ships with yet another way to perform mass text replacements more safely: Use run-of-the-mill diffs to show the changes that would be made if you applied a regular expression-based replacement. I love the ingenuity of this idea, because it is so obvious.

Continue reading …

Remote Bulk Editing Using Regexp with Emacs

A couple of days ago, I did maybe the weirdest and also most amazing thing on a remote machine thus far (with Emacs) and wanted to share the story. So there’s this EmulationStation software that organizes roms with XML lists for metadata. I needed to change the <name> field of about 100 entries there to drop a numeric prefix. That’d be easy on my local computer with tools I know well, but I was accessing the device remotely via SSH and wanted to see what I could do.

Continue reading …