I saved point to register, closed buffer / restarted Emacs and got:

user-error: That register’s buffer no longer exists

I want Emacs to open file if necessary and go to point.


I tried bookmarks and they survive buffer closing and Emacs reloading:

(info "Bookmarks (emacs)")

“Bookmarks” are somewhat like registers in that they record positions you can jump to. Unlike registers, they have long names, and they persist automatically from one Emacs session to the next. The prototypical use of bookmarks is to record where you were reading in various files.

Even more! ~/.emacs.d/bookmarks keeps lines like:

 (filename . "~/my/gtd/BLOG.rst")
 (front-context-string . "\nLegacy WSL was ")
 (rear-context-string . "larms.\n\nWSL\n===\n")
 (position . 1052073))

so Emacs is able to point cursor to the same position even if you edit surrounding (add/remove lines). See bookmark-search-size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.