2

The above error occurs when I try to set a bookmark on a help buffer. The bookmark looks like this:

#1=(#("Some bookmark" 0 3
(bmkp-full-record #1#))
(buffer-name . "*Help*")
(visits . 0)
(time . #2=(23804 60161 687807 800000))
(created . #2#)
(position . 1)
(help-fn . describe-variable)
(help-args dotspacemacs-distribution #<buffer bookmarks>)
(position . 1)
(handler . help-bookmark-jump))

Acording to @npostavs, the expression causing this is:

(help-args dotspacemacs-distribution #<buffer bookmarks>)

When I quote the last expression like this: "#<buffer bookmarks>", it works as expected.

3

By default, Bookmark+ saves bookmarks in such a way that you can have multiple bookmarks with the same bookmark name, but with different data. Whether this happens is controlled by option bmkp-propertize-bookmark-names-flag.

(Being able to have such bookmarks is handy for autofile bookmarks, that is, bookmarks whose names are automatically the same as the targeted file names, without the directory portion of the file name.)

For example, instead of a bookmark having a print (text) value like this in your bookmarks file:

("my-directory"
 (end-position . 1)
 (time 23761 39066 173375 0)
 (visits . 5)
 (tags "Directory")
 (filename . "z:/usr/pooba/foobear/")
 (position . 1)
 (created 23659 36406 596255 0))

It will have a print value like this, which records the full bookmark - all of the data - as a property on the string bookmark name:

#1=(#("my-directory" 0 13 (bmkp-full-record #1#))
    (end-position . 1)
    (time 23761 39066 173375 0)
    (visits . 5)
    (tags "Directory")
    (filename . "z:/usr/pooba/foobear/")
    (position . 1)
    (created 23659 36406 596255 0))

Somehow your saved bookmark list has gotten unreadable syntax due to improper circular references. Somewhere (perhaps in more than one place) you now have a # character that does not introduce a readable expression.

Dunno what caused that, but the most likely culprit was going back and forth between using Bookmark+ and using vanilla Emacs. See the Compatibility section of the Bookmark+ doc, where it says this:

Bookmark+ is generally compatible with Gnu Emacs versions 20 and later. You can use bookmarks with Bookmark+ regardless of whether they were created using Bookmark+ or vanilla Emacs (i.e., library bookmark.el).

But for best results, if you have bookmarks that you created using Bookmark+ then use Bookmark+, not vanilla Emacs, to access them. This section provides details.

Set user option bmkp-propertize-bookmark-names-flag, depending on your usage scenario:

Set it to nil if you will often be going back and forth between using Bookmark+ and using vanilla Emacs. (Do this also if you use Emacs 20.) Set it to non-nil if you instead always use only Bookmark+ (with Emacs 21 or later), or you use vanilla Emacs only to jump to bookmarks but never to update or create bookmarks.

This is VERY IMPORTANT. You can lose data if you do not respect it.

And this, soon after that passage:

Vanilla Emacs (21 and later) has no problem reading your bookmark file if it contains such circular structures. But if you then use it to save the file again, the Lisp code it writes has invalid Lisp read syntax (because it does not remove the circularity but it also does not bind print-circle to non-nil).

If that happens, the result is a bookmark file that is unreadable. It cannot be loaded into either vanilla Emacs or Bookmark+. If you do not have an uncorrupted backup version of the file to revert to, then you will need to edit it by hand to clean it up.

So do not let that happen to you! For best results use only Bookmark+ to access bookmarks created using Bookmark+.

If you must use vanilla Emacs with your bookmarks, then make sure they are not saved by Bookmark+ with the option non-nil: Using Bookmark+, set the option to nil and then save the file.

You said "Until recently I used bookmark+...". If the intention is to use vanilla Emacs after having saved bookmarks using Bookmark+, set bmkp-propertize-bookmark-names-flag to nil and save your bookmarks, to get a bookmark file with no propertized bookmark names, before switching to vanilla Emacs.


What you need to do now, regardless of whether you want to use vanilla Emacs or Bookmark+:

AFTER FIRST BACKING IT UP, edit your bookmark file by hand, to change any occurrences such as #("<BOOKMARK-NAME>" 0 MM (bmkp-full-record #N#)) to just "<BOOKMARK-NAME>" and remove any #N=, where N and MM are integers.

But first set option bmkp-propertize-bookmark-names-flag to nil, to make things simpler for the time being. (If you don't need to have multiple bookmarks with the same name then you can just leave as nil.)

Once you've cleaned up your bookmark file, back it up. And thereafter back it up occasionally. (If you had saved a backup recently then you would not now need to painfully edit it to fix the mess-up.)

If you have trouble when trying to follow these instructions, post here relevant parts of your bookmark file (alter or redact any personal info, of course), or follow up by email (see the bookmark+.el file header).

  • I think the problematic # expressions would look like #N where N is an integer (these are produced when printing a circular expression while print-circle is nil). #N=EXPR and #N# should be perfectly readable, no need to remove them. – npostavs Jun 5 at 22:30
  • @npostavs: Yes. But we have not seen exactly what the problematic code looks like; we know only that read choked on #. I've also updated the answer to point to what the problem most likely is, citing the doc. – Drew Jun 6 at 1:56

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.