Fanael / persistent-scratch

Preserve the scratch buffer across Emacs sessions
132 stars 14 forks source link

Restoring point doesn't work? #20

Closed tsuu32 closed 5 years ago

tsuu32 commented 5 years ago

I installed this package and added (persistent-scratch-setup-default) in init file.

It seems *scratch* buffer content is restored but cursor position is not restored.

(with-current-buffer (get-buffer-create "*scratch*")
  (goto-char 1))

It doesn't work when *scratch* buffer window is not selected. https://stackoverflow.com/questions/14720962/with-current-buffer-does-not-move-point

I don't know how to work around.

tsuu32 commented 5 years ago

I found a work around.

(add-hook 'after-init-hook #'persistent-scratch-setup-default)