changeset 92674:ac3c6c3e119c

* bookmark.el (bookmark-make): Don't pass the `annotation' to the make-record function, instead paste it in afterwards. (bookmark-make-record-for-text-file): * doc-view.el (doc-view-bookmark-make-record): * info.el (Info-bookmark-make-record): Don't mess with annotations.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 09 Mar 2008 03:05:34 +0000
parents afa4c247815a
children 141c5cc6c6fe
files lisp/ChangeLog lisp/bookmark.el lisp/doc-view.el lisp/info.el
diffstat 4 files changed, 55 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Mar 08 23:38:06 2008 +0000
+++ b/lisp/ChangeLog	Sun Mar 09 03:05:34 2008 +0000
@@ -1,3 +1,12 @@
+2008-03-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+
+	* bookmark.el (bookmark-make): Don't pass the `annotation' to the
+	make-record function, instead paste it in afterwards.
+	(bookmark-make-record-for-text-file):
+	* doc-view.el (doc-view-bookmark-make-record):
+	* info.el (Info-bookmark-make-record): Don't mess with annotations.
+
 2008-03-08  Glenn Morris  <rgm@gnu.org>
 
 	* calendar/diary-lib.el (entry): Declare for compiler part-way
--- a/lisp/bookmark.el	Sat Mar 08 23:38:06 2008 +0000
+++ b/lisp/bookmark.el	Sun Mar 09 03:05:34 2008 +0000
@@ -465,9 +465,7 @@
 locations that should be treated specially, such as Info nodes,
 news posts, images, pdf documents, etc.
 
-The function will be called with one argument: ANNOTATION.
-See `bookmark-make-record-for-text-file' for a description.
-
+The function will be called with no arguments.
 The returned record may contain a special cons (handler . SOME-FUNCTION)
 which sets the handler function that should be used to open this
 bookmark instead of `bookmark-default-handler'.  The handler should
@@ -489,17 +487,20 @@
         ;; already existing bookmark under that name and
         ;; no prefix arg means just overwrite old bookmark
         (setcdr (bookmark-get-bookmark stripped-name)
-                (list (funcall bookmark-make-record-function annotation)))
+                (list (funcall bookmark-make-record-function)))
 
       ;; otherwise just cons it onto the front (either the bookmark
       ;; doesn't exist already, or there is no prefix arg.  In either
       ;; case, we want the new bookmark consed onto the alist...)
 
-      (setq bookmark-alist
-            (cons
-             (list stripped-name
-                   (funcall bookmark-make-record-function annotation))
-             bookmark-alist)))
+      (push (list stripped-name
+                  (funcall bookmark-make-record-function))
+            bookmark-alist))
+
+    (when annotation
+      ;; Take no chances with text properties.
+      (set-text-properties 0 (length annotation) nil annotation)
+      (bookmark-prop-set stripped-name 'annotation annotation))
 
     ;; Added by db
     (setq bookmark-current-bookmark stripped-name)
@@ -509,37 +510,24 @@
         (bookmark-save))))
 
 
-(defun bookmark-make-record-for-text-file (annotation)
-  "Return the record part of a new bookmark, given ANNOTATION.
+(defun bookmark-make-record-for-text-file ()
+  "Return the record describing the location of a new bookmark.
 Must be at the correct position in the buffer in which the bookmark is
 being set (this might change someday)."
-  (let ((the-record
-         `((filename . ,(bookmark-buffer-file-name))
-           (front-context-string
-            . ,(if (>= (- (point-max) (point)) bookmark-search-size)
-                   (buffer-substring-no-properties
-                    (point)
-                    (+ (point) bookmark-search-size))
-                   nil))
-           (rear-context-string
-            . ,(if (>= (- (point) (point-min)) bookmark-search-size)
-                   (buffer-substring-no-properties
-                    (point)
-                    (- (point) bookmark-search-size))
-                   nil))
-           (position . ,(point)))))
-
-    ;; Now fill in the optional parts:
-
-    ;; Take no chances with text properties
-    (set-text-properties 0 (length annotation) nil annotation)
-
-    (if annotation
-        (nconc the-record (list (cons 'annotation annotation))))
-
-    ;; Finally, return the completed record.
-    the-record))
-
+  `((filename . ,(bookmark-buffer-file-name))
+    (front-context-string
+     . ,(if (>= (- (point-max) (point)) bookmark-search-size)
+            (buffer-substring-no-properties
+             (point)
+             (+ (point) bookmark-search-size))
+          nil))
+    (rear-context-string
+     . ,(if (>= (- (point) (point-min)) bookmark-search-size)
+            (buffer-substring-no-properties
+             (point)
+             (- (point) bookmark-search-size))
+          nil))
+    (position . ,(point))))
 
 
 ;;; File format stuff
--- a/lisp/doc-view.el	Sat Mar 08 23:38:06 2008 +0000
+++ b/lisp/doc-view.el	Sun Mar 09 03:05:34 2008 +0000
@@ -1082,20 +1082,10 @@
 
 ;;;; Bookmark integration
 
-(defun doc-view-bookmark-make-record (annotation)
-  (let ((the-record
-         `((filename . ,buffer-file-name)
-           (page     . ,(doc-view-current-page))
-           (handler  . doc-view-bookmark-jump))))
-
-    ;; Take no chances with text properties
-    (set-text-properties 0 (length annotation) nil annotation)
-
-    (when annotation
-      (nconc the-record (list (cons 'annotation annotation))))
-
-    ;; Finally, return the completed record.
-    the-record))
+(defun doc-view-bookmark-make-record ()
+  `((filename . ,buffer-file-name)
+    (page     . ,(doc-view-current-page))
+    (handler  . doc-view-bookmark-jump)))
 
 
 (declare-function bookmark-get-filename        "bookmark" (bookmark))
--- a/lisp/info.el	Sat Mar 08 23:38:06 2008 +0000
+++ b/lisp/info.el	Sun Mar 09 03:05:34 2008 +0000
@@ -4336,34 +4336,22 @@
   (if file Info-current-file Info-current-node))
 
 
-(defun Info-bookmark-make-record (annotation)
-  (let ((the-record
-         `((filename . ,(bookmark-buffer-file-name))
-           (front-context-string
-            . ,(if (>= (- (point-max) (point)) bookmark-search-size)
-                   (buffer-substring-no-properties
-                    (point)
-                    (+ (point) bookmark-search-size))
-		 nil))
-           (rear-context-string
-            . ,(if (>= (- (point) (point-min)) bookmark-search-size)
-                   (buffer-substring-no-properties
-                    (point)
-                    (- (point) bookmark-search-size))
-		 nil))
-	   (info-node . ,Info-current-node)
-	   (handler . Info-bookmark-jump))))
-
-    ;; Now fill in the optional parts:
-
-    ;; Take no chances with text properties
-    (set-text-properties 0 (length annotation) nil annotation)
-
-    (if annotation
-        (nconc the-record (list (cons 'annotation annotation))))
-
-    ;; Finally, return the completed record.
-    the-record))
+(defun Info-bookmark-make-record ()
+  `((filename . ,(bookmark-buffer-file-name))
+    (front-context-string
+     . ,(if (>= (- (point-max) (point)) bookmark-search-size)
+            (buffer-substring-no-properties
+             (point)
+             (+ (point) bookmark-search-size))
+          nil))
+    (rear-context-string
+     . ,(if (>= (- (point) (point-min)) bookmark-search-size)
+            (buffer-substring-no-properties
+             (point)
+             (- (point) bookmark-search-size))
+          nil))
+    (info-node . ,Info-current-node)
+    (handler . Info-bookmark-jump)))
 
 
 (defvar bookmark-current-bookmark)