9

I would like to save the last position of point in the buffer I am visiting, so to have point still there when I go back to that file.

I understand I can use saveplace for this, so I added this snippet in my configuration:

(use-package saveplace ; Save point position in files
  :init (progn
          (setq-default save-place t)
          (toggle-save-place-globally)))

Yet I am not getting the desired behavior: point is still place at the beginning of the buffer.

I am using Emacs 25.0.50.1 (45c92dd), but the same thing is happening with emacs -Q.

Drew
  • 75,699
  • 9
  • 109
  • 225
Manuel Uberti
  • 3,150
  • 18
  • 36

1 Answers1

13

I am using Emacs 25.0.50.8 and I noticed the behavior of the save-place variable has been changed:

This variable is obsolete since 25.1; use `save-place-mode' instead.

You can type C-h v save-place to read its full documentation.

Below is my config:

(use-package saveplace
  :init (save-place-mode))
xuchunyang
  • 14,302
  • 1
  • 18
  • 39
  • 4
    There's not much use in `:defer t`, since calling `save-place-mode` in `:init` will trigger loading immediately anyway. – npostavs May 26 '15 at 15:18
  • @npostavs You are right. I forgot that requiring already loaded feature has no effect. I'll update my answer. Thanks for the tip. – xuchunyang May 26 '15 at 16:07
  • Is there a list somewhere of things I need to update after upgrading to Emacs 25 so that other things like this don't break? – incandescentman Jul 26 '16 at 17:48
  • 1
    @incandescentman Yes, just read the Emacs NEWS via `C-h n` (`view-emacs-news`), you can also pass a prefix argument to limit it to one specific version such as 25.1. – xuchunyang Jul 26 '16 at 19:16
  • When I added this config to my init.el I got an error: `Symbol's function definition is void: use-package` – Grant Bowman Dec 01 '17 at 08:08
  • 1
    @GrantBowman Looks like you don't use `use-package`, thus all you need is `(save-place-mode)`. – xuchunyang Dec 01 '17 at 09:27