Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I mirror edit actions in multiple buffers in Emacs?

Tags:

emacs

I have two buffers open side by side in Emacs. As I delete (or modify) lines in the first file, I would like the second file to receive the same commands / cursor position. Is this possible?

like image 495
sdasdadas Avatar asked Nov 12 '22 21:11

sdasdadas


1 Answers

The closest thing I know of to what you've described is the multiple-cursors package, which is pretty cool, but it only implements multiple cursors within a single buffer. So I suppose that you could:

  1. Append one of the buffer contents to the other;
  2. Spawn multiple cursors using the package I mentioned;
  3. Split the windows;
  4. Edit away;
  5. Move the appended buffer contents back to its original location.

With what I suspect would be a considerable amount of hacking, one might be able to extend multiple-cursors to handle multiple buffers, but I think this would be opening up a huge can of worms. What if the two buffers are in different modes, and you enter a key sequence that's bound to different commands that do vastly different things?

like image 144
Sean Avatar answered Nov 15 '22 13:11

Sean