Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there emacs capability for visiting last edits?

In the JetBrains products, there's a very handy key binding that lets you visit all the spots you made an edit. Hit the key once to go to the last edit (file and location), and keep hitting the key to go back to earlier edits. It's typically when editing that you want to be editing the same places over and over again, and if one has many buffers open, many of which are not edited, this is even more useful.

Emacs has a mark ring, but that's not quite the same thing.

On a related note, is there functionality in magit, the emacs git add-on, to jump to edits?

like image 332
justingordon Avatar asked May 09 '13 19:05

justingordon


People also ask

What is the point of using Emacs?

Why Emacs? Emacs helps you be productive by providing an integrated environment for many different kinds of tasks: All of the basic editing commands (and there are lots of them) are available no matter what you're trying to do: write code, read a manual, use a shell, or compose an email.

How to edit a file on Emacs?

The emacs editing mode is entered when you enable either the emacs or gmacs option. The only difference between these two modes is the way each handles the Ctrl-T edit command. To edit, move the cursor to the point needing correction and insert or delete characters or words, as needed.

How do I create a data file in Emacs?

You may also write the contents of the buffer to a different file with the command Control-X-Control-W. Emacs will prompt you for the name of the file you want to create. To create a new file, use Control-X-Control-F, just as if the file already existed.


2 Answers

There is GotoLastChange which allows you to travel along the chain of undo locations. You can assign it to a key:

(global-set-key "\C-x\C-\\" 'goto-last-change)

like image 183
Alex Vorobiev Avatar answered Oct 12 '22 12:10

Alex Vorobiev


There is GotoChg which allows you to travel back and forth the chain of undo locations. Sample init code snippet:

(require 'goto-chg)
(global-set-key [(control ?.)] 'goto-last-change)
(global-set-key [(control ?,)] 'goto-last-change-reverse)

(Just like the other alternatives, GotoLastChange and session.el, it can not jump between buffers)

like image 40
David Andersson Avatar answered Oct 12 '22 13:10

David Andersson