]> git.eshelyaron.com Git - emacs.git/commitdiff
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 9 Mar 2008 03:05:34 +0000 (03:05 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 9 Mar 2008 03:05:34 +0000 (03:05 +0000)
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.

lisp/ChangeLog
lisp/bookmark.el
lisp/doc-view.el
lisp/info.el

index 119b6f24e59348e3f114141c1517a7e6cc0907e0..4d1e78eca6335184eefb590f717797f99561b859 100644 (file)
@@ -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
index b919823ce7a6250caeabe1f3cb55598a89ee4fc7..be3156549c134b980a4df04f9c576af831a6123a 100644 (file)
@@ -465,9 +465,7 @@ Modes may set this variable buffer-locally to enable bookmarking of
 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 @@ this name."
         ;; 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 @@ this name."
         (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))))
 
 \f
 ;;; File format stuff
index 83420c72731cc63833446344bbb259fa82e5a2ec..43d06f3c077c9c9e551a0129aa17ca603969b841 100644 (file)
@@ -1082,20 +1082,10 @@ See the command `doc-view-mode' for more information on this mode."
 
 ;;;; 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))
index 2c8eee9da4785f73c8304e8a7e439c34424e3958..d93d93e7c4b964c0b9b58d0c78420e9191d7a374 100644 (file)
@@ -4336,34 +4336,22 @@ When FILE is non-nil, return the Info file instead."
   (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)