unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Bookmarks: (invalid-read-syntax "#")
@ 2012-09-12 19:03 Sebastien Vauban
  2012-09-13 14:43 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastien Vauban @ 2012-09-12 19:03 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Hello,

Since short (since testing bookmark+, maybe? -- for which I'll definitively
will invest more time[1] as it covers everything I need), I have the following
error when refiling or capturing in Org:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (invalid-read-syntax "#")
  read(#<buffer bookmarks.txt>)
  bookmark-alist-from-buffer()
  bookmark-load("~/.emacs.d/bookmarks.txt" t t)
  bookmark-maybe-load-default-file()
  bookmark-set("org-capture-last-stored")
  (save-restriction (widen) (goto-char pos) (bookmark-set "org-capture-last-stored") (move-marker org-capture-last-stored-marker (point)))
  (save-excursion (save-restriction (widen) (goto-char pos) (bookmark-set "org-capture-last-stored") (move-marker org-capture-last-stored-marker (point))))
  (save-current-buffer (set-buffer (buffer-base-buffer (current-buffer))) ...)
  (with-current-buffer (buffer-base-buffer (current-buffer)) ...)
  (let* ((where (org-capture-get :position-for-last-stored (quote local))) ...)
  org-capture-bookmark-last-stored-position()
  (progn (org-capture-bookmark-last-stored-position))
  (if org-capture-bookmark (progn (org-capture-bookmark-last-stored-position)))
  (when org-capture-bookmark (org-capture-bookmark-last-stored-position))
  (if org-note-abort ...)
  (let ((beg (point-min)) (end (point-max)) ...)
  ad-Orig-org-capture-finalize(nil)
  org-capture-finalize(nil)
--8<---------------cut here---------------end--------------->8---

I see where the # could come from:

--8<---------------cut here---------------start------------->8---
;;;; Emacs Bookmark Format Version 1 ;;;;
;;; This format is meant to be slightly human-readable;
;;; nevertheless, you probably don't want to edit it.
;;; -*- End Of Bookmark File Format Version Stamp -*-
((#("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))
 ...
--8<---------------cut here---------------end--------------->8---

... but I don't dare modifying that file by hand, as I'm not supposed to do
it.

Do you have an explanation, or work around my problem?

Best regards,
  Seb

[1] To have the same line colored as it is (by default) with `bm'.

-- 
Sebastien Vauban


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Bookmarks: (invalid-read-syntax "#")
  2012-09-12 19:03 Bookmarks: (invalid-read-syntax "#") Sebastien Vauban
@ 2012-09-13 14:43 ` Drew Adams
  2012-09-24 16:36   ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2012-09-13 14:43 UTC (permalink / raw)
  To: 'Sebastien Vauban', help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Bookmarks: (invalid-read-syntax "#")
  2012-09-13 14:43 ` Drew Adams
@ 2012-09-24 16:36   ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2012-09-24 16:36 UTC (permalink / raw)
  To: 'Sebastien Vauban', help-gnu-emacs

> Sent: Thursday, September 13, 2012 7:43 AM

This is a followup message to point to an explanation of the problem cited in
this thread, which a couple of Bookmark+ users ran into.  I have updated the
Bookmark+ doc to warn about it:
http://www.emacswiki.org/emacs/BookmarkPlus#Compatibility

See also Emacs bug #12503:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12503


The bottom line is this: if you have bookmarks that you created using Bookmark+
then use Bookmark+, not vanilla Emacs, to access them.

Or if you will often be going back and forth between using Bookmark+ and using
vanilla Emacs, then customize option `bmkp-propertize-bookmark-names-flag' to
nil.


Setting the option to nil means you will forego being able to use multiple
bookmarks that have the same name, which is particularly useful for "autofiles".

An autofile is a bookmark whose name is the nondirectory part of the targeted
file name.  If the option is non-nil then you can have different autofiles in
different directories but with the same name.

You can use autofiles pretty much the same way you use files in Emacs, even
though they are actually bookmarks.  Because they are bookmarks, with Bookmark+
you can do things like tag them in various ways (a la Delicious).
http://www.emacswiki.org/emacs/BookmarkPlus#AutofileBookmarks

HTH.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-24 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-12 19:03 Bookmarks: (invalid-read-syntax "#") Sebastien Vauban
2012-09-13 14:43 ` Drew Adams
2012-09-24 16:36   ` Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).