Opening two scratch-like buffers on GNU Emacs

🗒️ tl;dr: Run C-x b <buffer-name> with different buffer names.

This week, I had a task that involved comparing two pieces of text against each other. GNU Emacs has a perfect function for this, called “ediff-buffers”. You call it typing by “M-x ediff-buffers”, and then selecting the two buffers you want to compare. Quite easy, right? However, I tried to open two scratch buffers to paste my text and discovered you can’t just C-u 2 M-x scratch-buffer to open two scratch buffers.

It turns out you can use the function “switch-to-buffer” to the same effect. Press “C-x b” (default keybinding) and type a name for your new buffer. This should be enough to give you an empty buffer.

However, some time afterwards, I discovered the functions “ediff-regions-wordwise” and “ediff-regions-linewise”. These functions made the entire task easier because I could paste both texts into the same buffer and then select the regions individually to compare them.


Articles from blogs I follow around the net

Trimming a Fake Object

A refactoring example. When I introduce the Fake Object testing pattern to people, a common concern is the maintenance burden of it. The point of the pattern is that you write some 'working' code only for test purposes. …

via ploeh blog November 20, 2023

Building a digital vigil for those we've lost

This post is hard to write in a lot of ways. It's more personal than most I've written. This is presumptively a tech blog, and this piece is about so much more than technology. But it's important. Making things, software or otherwise, is ultimatel…

via ntietz.com blog November 19, 2023

#122 Experimenting and Learning

Update on what happened across the GNOME project in the week from November 10 to November 17. GNOME Circle Apps and Libraries Workbench A sandbox to learn and prototype with GNOME technologies. Sonny says Workbench is a code playground and Library to learn, e…

via This Week in GNOME November 17, 2023

Generated by openring