1

Assume that I open a file and start editing it (at least one character is inserted). Assume that the cursor is at Place A when the last change to the file is done (i.e. the last character is inserted). Then I take the cursor to another place in the same buffer (say place B). During this, I don't insert anything, but perhaps I execute some commands.

Is it possible to return from the place B to the original place A?

Name
  • 7,689
  • 4
  • 38
  • 84

2 Answers2

3

If you are okay with returning to the last edit (as opposed to last insertion), you might want to look at the package goto-chg. You can enable it like this:

(require 'goto-chg)

(global-set-key (kbd "C-.") #'goto-last-change)
(global-set-key (kbd "C-,") #'goto-last-change-reverse)
PythonNut
  • 10,243
  • 2
  • 29
  • 75
1

I know it's dumb compared to goto-chg, and also jumps to any kind of edit, not the last insertion, but I often undo, insert a space, and undo again (that space insert)... which places me back at the point of the last change.

Ted Zlatanov
  • 404
  • 2
  • 4
  • The problem with this solution is that the first undo change the last edit, which may cause come inconveniences in some situations. Maybe I miss something... – Name Feb 02 '15 at 14:35
  • Right, so you make a new edit (insert space), then undo the edit and you're back at the original state. It's easier to do than to explain :) – Ted Zlatanov Feb 02 '15 at 19:19
  • Ok, I got it. Nice hack. – Name Feb 02 '15 at 20:36