emacs tip: save cursor position across sessions

Perm URL with updates: http://ergoemacs.org/emacs/emacs_save_cursor_position.html

You can save the cursor position for every file you opened. So, next time you open the file, the cursor will be at the position you last opened it.

Put this code in your emacs init file:

;; turn on save place so that when opening a file, the cursor will be at the last position.
(require 'saveplace)
(setq save-place-file (concat user-emacs-directory "saveplace.el") ) ; use standard emacs dir
(setq-default save-place t)

This mode is ancient, from 1993. 〔saveplace.el〕 is written by Karl Fogel, who is active on emacs dev mailing list as of . Karl is also famous as the one who wrote one of the first open source book (if i recall correctly, it became the offical cvs documentation for many years). Karl is also the author of Emacs's Bookmark Feature. Thanks Karl.