summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-03-09 03:05:34 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-03-09 03:05:34 +0000
commit32a091dd1996bd3b3f3c7ec2321c5c19e2c01642 (patch)
treeb98e6b2a21ff367bee7ecc34681189afede3e476
parent604957164e5725e087a5c83e87a213e83e4c0a6e (diff)
downloademacs-32a091dd1996bd3b3f3c7ec2321c5c19e2c01642.tar.gz
* 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.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/bookmark.el64
-rw-r--r--lisp/doc-view.el18
-rw-r--r--lisp/info.el44
4 files changed, 55 insertions, 80 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 119b6f24e59..4d1e78eca63 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index b919823ce7a..be3156549c1 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -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))))
;;; File format stuff
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 83420c72731..43d06f3c077 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -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))
diff --git a/lisp/info.el b/lisp/info.el
index 2c8eee9da47..d93d93e7c4b 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -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)