I'm looking at Bookmark+, but is there any way to have multiple bookmarks per file, as in multiple line numbers per file.

When I make a new bookmark in a file, the old one disappears, so it seems as if there's only a single bookmark for each file?;)

2 Answers 2

  1. You can have any number of bookmarks to the same file. To different or even the same location within the file. This is true of both vanilla bookmark.el and Bookmark+.

  2. Yes, you typically just give bookmarks different names, e.g., to target different locations in the same file.

  3. But you can have bookmarks that have the same name, and they can go to either the same location (e.g., same position or same file) or different locations.

  4. But in vanilla Emacs, in this case only the latest bookmark of the same name -- that is, the one closest to the front of the bookmark-alist -- is usable at any time. It shadows any others that have the the same name.

  5. With Bookmark+, you can have any number of bookmarks with the same name, and they can all be used. Whether this is possible is controlled by user option bmkp-propertize-bookmark-names-flag. By default it is t, meaning that you can have multiple, usable bookmarks with the same name.

bmkp-propertize-bookmark-names-flag is a variable defined in bookmark+-bmu.el.

Its value is t


Non-nil means to propertize bookmark names to hold full bookmark data.

This means that you can effectively have more than one bookmark with the same name.

Just FYI, in case you're interested in Lisp things -

If the value is non-nil and you examine the internal definitions of bookmarks (e.g. by opening your bookmark file or using C-h v bookmark-alist), then you'll see the propertized strings written something like this (instead of just "NAME"), where NAME is the bookmark name:

#("NAME" 0 15 (bmkp-full-record #1))

(If you examine the internal form of a bookmark using C-u C-h RET, then you won't see that. The help output removes that noise, to just show you "NAME".)

That propertized-string Lisp syntax shows that the bookmark-name string "NAME" has property bmkp-full-record, whose value is in fact the list that is the full bookmark record, including that string itself!

You can customize this variable.

What Bookmark+ calls autofiles are in fact bookmarks whose names are the same as the files they target (with the target position at the start of the file). They're easy to create (you're not prompted for the bookmark name).

The bookmark name is only the nondirectory part of the file name. So you can have multiple autofile bookmarks with the same (bookmark) name, for files with the same name in different directory.

Autofiles give you, in effect, a way to treat bookmarks as files. In particular, they give you a way to tag files.


Give your bookmarks unique names.

You can easily have multiple bookmarks into a single file with even plain old bookmarks by giving each bookmark a unique name.

  • C-x r m will call bookmark-set which will ask you for a name for the bookmark. Give it a unique name.
  • Go to different lines in the same file and set bookmarks with unique names.
  • C-x r l should show you multiple bookmarks in the same file.

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.