--- Begin Message ---
Subject: |
24.2.50; `bookmark-write-file' should bind `print-circle' to t |
Date: |
Mon, 24 Sep 2012 09:11:36 -0700 |
Users can define their own bookmark types, which can store anything at
all in bookmark records, that is, any Lisp objects.
Such objects can contain circularities: one part referring to another
part or to the whole - IOW circular lists.
When `bookmark-write-file' writes a bookmark list to the bookmark file,
it takes care to bind `print-length' and `print-level' to nil, but it
does yet not bind `print-circle' to t. It should do that as well.
The result currently is that a user's bookmark file can be corrupted,
becoming unreadable because it contains invalid Lisp `read' syntax.
I have seen this a couple of times now, with users of Bookmark+.
Bookmark+ does use bookmarks that have circular structure, and it saves
them correctly by binding `print-circle' to t.
A user can read such a bookmark file into vanilla Emacs, and s?he can
use the bookmarks there. But if s?he then saves the file again, in
vanilla Emacs, the result is invalid Lisp.
The file cannot be read (in either vanilla Emacs or Bookmark+). The
user has lost bookmarks and can recuperate them only by hand-editing the
corrupted file, which is laborious and error prone.
The simple change of binding `print-circle' to t will have no negative
effect on bookmark.el behavior, and it will solve the problem,
preventing data loss if users have defined bookmark structures that are
circular.
In GNU Emacs 24.2.50.1 (i386-mingw-nt5.1.2600)
of 2012-09-17 on MARVIN
Bzr revision: 110062 address@hidden
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
`configure --with-gcc (4.7) --no-opt --enable-checking --cflags
-ID:/devel/emacs/libs/libXpm-3.5.8/include
-ID:/devel/emacs/libs/libXpm-3.5.8/src
-ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
-ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
-ID:/devel/emacs/libs/giflib-4.1.4-1/include
-ID:/devel/emacs/libs/jpeg-6b-4/include
-ID:/devel/emacs/libs/tiff-3.8.2-1/include
-ID:/devel/emacs/libs/gnutls-3.0.9/include
-ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
-ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'
--- End Message ---
--- Begin Message ---
Subject: |
Re: `bookmark-write-file' should bind `print-circle' to t |
Date: |
Sun, 30 Sep 2012 22:48:55 -0500 |
Done:
revno: 110307
revision-id: address@hidden
parent: address@hidden
committer: Karl Fogel <address@hidden>
branch nick: trunk
timestamp: Sun 2012-09-30 22:44:59 -0500
message:
* lisp/bookmark.el (bookmark-write-file): Bind `print-circle' to `t'
here to allow circular custom bookmark types. (Bug#12503)
Diff:
--- lisp/bookmark.el 2012-10-01 03:34:02 +0000
+++ lisp/bookmark.el 2012-10-01 03:41:42 +0000
@@ -1359,7 +1359,12 @@
(goto-char (point-min))
(delete-region (point-min) (point-max))
(let ((print-length nil)
- (print-level nil))
+ (print-level nil)
+ ;; See bug #12503 for why we bind `print-circle'. Users
+ ;; can define their own bookmark types, which can result in
+ ;; arbitrary Lisp objects being stored in bookmark records,
+ ;; and some users create objects containing circularities.
+ (print-circle t))
(bookmark-insert-file-format-version-stamp)
(insert "(")
;; Rather than a single call to `pp' we make one per bookmark.
--- End Message ---