Pages

Sunday, June 26, 2011

Remember the last cursor position in Emacs

It is often always useful to have Emacs remember the last cursor position of a file that you had opened. Add the following code to your .emacs file to accomplish this.

(setq save-place-file "~/.emacs.d/saveplace")
(setq-default save-place t)
(require 'saveplace)

The save-place-file variable identifies the file location where the cursor position information is kept. I like to keep my home directory clean of unnecessary files so I have defined it to ~/.emacs.d/saveplace.

No comments:

Post a Comment