Purpose: When you visit a file, point goes to the last place where it was when you previously visited the same file.

To use it, turn it on in the options menu - “Save place in files between Sessions”.

Alternatively, you could add the following to your InitFile:

For GNU Emacs 25.1 and newer versions

(save-place-mode 1) 

Note that saveplace is auto-loaded by save-place-mode. So you do not need to explicitly require it.

For GNU Emacs 24.5 and older versions

(require 'saveplace)
(setq-default save-place t)

Note that using setq will not do because the variable is buffer-local.


Your saved places are written to the file stored in the file specified by save-place-file. This defaults to ~/.emacs.d/places in newer emacs versions (25.1+) and to ~/.emacs-places in older emacs versions. In the latter case, you might want to change it to keep your home directory uncluttered.

For example:

(setq save-place-file (locate-user-emacs-file "places" ".emacs-places"))

If emacs is slow to exit after enabling saveplace, you may be running afoul of save-place-forget-unreadable-files. On exit, it checks that every loaded file is readable before saving its buffer position - potentially very slow if you use NFS.

(setq save-place-forget-unreadable-files nil)

will restores emacs exit to nearly instantaneous.

SessionManagement CategoryPersistence