help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Bookmarks: (invalid-read-syntax "#")


From: Drew Adams
Subject: RE: Bookmarks: (invalid-read-syntax "#")
Date: Thu, 13 Sep 2012 07:43:24 -0700

Hi Seb,

Please feel free to follow up with me off list.  I've had 2 other reports of the
same problem over the past year.  Somehow your file bookmark got corrupted.
This is no doubt a problem due to Bookmark+, but I don't yet know how/why.  I
would like to get more info, if possible.

The bottom line about the fix is that you will need to either revert to a backup
copy of your bookmark file or edit it by hand.  See below.  (See also option
`bookmark-version-control' - you might want to set it to `t' from now on, to be
sure of having a good backup file.)

Bookmark+ can optionally save propertized strings (e.g., the bookmark name) to
your bookmark file - see option 'bmkp-propertize-bookmark-names-flag'.  And
somehow the printout to your bookmark file produced bad `read' syntax, so the
file cannot be loaded.

The advantages of saving propertized strings include having multiple bookmarks
with the same name.  This is important for autofile bookmarks because the
bookmark name is only the non-directory part of the file name. This Bookmark+
feature lets you have different autofile bookmarks for files of the same name in
different directories.

The bookmark name saved in the bookmark has a text property that contains the
complete bookmark information, so that all that is needed is that string.  Such
a bookmark is (should be) saved like this:

#1=(#("foo" 0 13 (bmkp-full-record #1#))
    (filename . "c:/mydir/foo")
    (buffer-name . "foo")
    (front-context-string)
    (rear-context-string)
    (front-context-region-string)
    (rear-context-region-string)
    (visits . 0)
    (time 20442 4422 172000)
    (created 20442 4422 172000)
    (position . 1)
    (end-position . 1))

The bookmark name, `foo', is this propertized string:
#("foo" 0 13 (bmkp-full-record #1#)

The #1= and #1# syntax is how Emacs writes a circular reference.  #1 refers to
the entire bookmark structure, and you can see that the string "foo" is
propertized with property `bmkp-full-record' which has the value #1#, which is a
reference to #1, i.e., to the entire bookmark structure.

But somehow, with the problem you are seeing, it got saved like this, which has
invalid read syntax:

#("foo" 0 13 (bmkp-full-record #0))

See also these parts of the doc:
http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus#toc65
http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus#toc34

If you do any hand editing of your bookmarks file, be sure to 
back it up first, even if it is corrupted.  It is a 
plain-text file, so it can always be edited to fix things.

> ((#("lit fait mvmt" 0 16
>    (bmkp-full-record #0))
>  (filename . "~/Projects/entr.awk")
>  (buffer-name . "entr.awk")
>  (front-context-string . "function lit_fai")
>  (rear-context-string . "nes incorrectes\n")
>  (front-context-region-string)
>  (rear-context-region-string)
>  (visits . 0)
>  (time 20521 6580 48000)
>  (created 20521 6580 48000)
>  (position . 59496)
>  (end-position . 59496))
>
> but I don't dare modifying that file by hand, as I'm not 
> supposed to do it.

You will have to edit it by hand, or else revert to a backup copy of your
bookmark file.  The editing is no big deal (but could take a while if you have
many such invalid bookmarks): Just replace the #("..." ...) with "...".  So in
this case, you get (("lit fait mvmt" (filename ....) (buffer-name...)...)

Again, please feel free to follow up with me off list.  I would like to figure
out what is sometimes causing this problem.  Sorry for the trouble.

Thx - Drew




reply via email to

[Prev in Thread] Current Thread [Next in Thread]