Teddy
Teddy

Reputation: 2006

In Emacs, what is the command to move the pointer to the location of the last edit?

What lisp config command would bind this command, if it's not already bound?

Also, If I wanted to bind C-x h, C-M-\, and , to a single C-M-\, how would this be done?

Thanks in advance

Upvotes: 2

Views: 420

Answers (3)

Sean
Sean

Reputation: 29772

I do this all the time by typing C-/ (undo last edit), then C-f (or any other trivial movement command), then C-/ (redo last edit).

Upvotes: 0

aculich
aculich

Reputation: 14855

The function session-jump-to-last-change is part of session.el which I typically bind to these two key sequences for convenience: C-xC-/ and C-A-/. I pick those keys because it is similar to undo which is bound by default to C-/.

(autoload 'session-jump-to-last-change "session")
(global-set-key (kbd "C-x C-/") 'session-jump-to-last-change)
(global-set-key (kbd "C-A-/") 'session-jump-to-last-change)

Upvotes: 4

alexmurray
alexmurray

Reputation: 925

By default there is no command to move to the location of the last edit, but you can easily add it by using something like http://www.emacswiki.org/emacs/GotoLastChange - download the elisp file, put it in your load-path and bind it:

(autoload 'goto-last-change "goto-last-change"
   "Set point to the position of the last change." t)
;; bind to C-x C-\
(global-set-key (kbd "C-x C-\\") 'goto-last-change)

Upvotes: 0

Related Questions