Emacs: Bookmarks in Registers

I was wondering the other day if there was some way to store a bookmark-style position in a register. In Emacs 28.2, there is point-to-register and register-to-point:

This sounds like just what you need. However, the problem with these is that if the buffer in-question changes, then running register-to-point will not take you where you want to go. E.g., if you run point-to-register inside an *info* buffer, and then move the buffer to some other info page, then this will not take you back to the original info page.

Of course, you can just use a regular bookmark instead, but then you must name the bookmark, and then the bookmark clutters up your list of bookmarks. What I want is to be able to store an anonymous bookmark in a register, which is handy if you only need a bookmark for a little while.

With a bit of experimentation and looking at the register.el source code, I was able to throw this together:

This seems to work great. The only downside is that `list-bookmarks' does not understand what is stored in the register, so the preview display will be incorrect. When I tested this, it interpreted it as a rectange data structure. I think to fix this, you would need to add a new `register-val-describe' method like in register.el. But I'm not quite sure how to code that.

Proxied content from gemini://gem.librehacker.com/gemlog/starlog/20230607-0.gmi

Gemini request details:

Original URL
gemini://gem.librehacker.com/gemlog/starlog/20230607-0.gmi
Status code
Success
Meta
text/gemini
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.