0

I know about Book Marks, which is a great way to save shortcuts to certain files and locations within them.

However, when I C-x r m in a non-file buffer, say Python or Shell, I only get:

bookmark-buffer-file-name: Buffer not visiting a file or directory

Is there any way to (temporarily) bookmark the location in a non-file buffer?

1 Answer 1

2

If you use Bookmark+ then it just works, out of the box.

Vanilla Emacs doesn't bookmark nonfile buffers unless the context (e.g. the major mode) specifically defines a way to do so. It does that for Info buffers (nodes in manuals), for example.

You can do that yourself, for any given mode, so you can bookmark nonfile buffers without using Bookmark+. See file info.el for an example of how to do that - search for "bookmark". It defines function Info-bookmark-make-record, to create an Info bookmark, and it sets variable bookmark-make-record-function to that function buffer-locally:

(setq-local bookmark-make-record-function #'Info-bookmark-make-record)

It defines command Info-bookmark-jump, to jump to such a bookmark.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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