diff options
| author | Stefan Monnier | 2008-03-09 03:05:34 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-03-09 03:05:34 +0000 |
| commit | 32a091dd1996bd3b3f3c7ec2321c5c19e2c01642 (patch) | |
| tree | b98e6b2a21ff367bee7ecc34681189afede3e476 | |
| parent | 604957164e5725e087a5c83e87a213e83e4c0a6e (diff) | |
| download | emacs-32a091dd1996bd3b3f3c7ec2321c5c19e2c01642.tar.gz emacs-32a091dd1996bd3b3f3c7ec2321c5c19e2c01642.zip | |
* 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/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/bookmark.el | 64 | ||||
| -rw-r--r-- | lisp/doc-view.el | 18 | ||||
| -rw-r--r-- | lisp/info.el | 44 |
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 @@ | |||
| 1 | 2008-03-09 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | |||
| 4 | * bookmark.el (bookmark-make): Don't pass the `annotation' to the | ||
| 5 | make-record function, instead paste it in afterwards. | ||
| 6 | (bookmark-make-record-for-text-file): | ||
| 7 | * doc-view.el (doc-view-bookmark-make-record): | ||
| 8 | * info.el (Info-bookmark-make-record): Don't mess with annotations. | ||
| 9 | |||
| 1 | 2008-03-08 Glenn Morris <rgm@gnu.org> | 10 | 2008-03-08 Glenn Morris <rgm@gnu.org> |
| 2 | 11 | ||
| 3 | * calendar/diary-lib.el (entry): Declare for compiler part-way | 12 | * 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 | |||
| 465 | locations that should be treated specially, such as Info nodes, | 465 | locations that should be treated specially, such as Info nodes, |
| 466 | news posts, images, pdf documents, etc. | 466 | news posts, images, pdf documents, etc. |
| 467 | 467 | ||
| 468 | The function will be called with one argument: ANNOTATION. | 468 | The function will be called with no arguments. |
| 469 | See `bookmark-make-record-for-text-file' for a description. | ||
| 470 | |||
| 471 | The returned record may contain a special cons (handler . SOME-FUNCTION) | 469 | The returned record may contain a special cons (handler . SOME-FUNCTION) |
| 472 | which sets the handler function that should be used to open this | 470 | which sets the handler function that should be used to open this |
| 473 | bookmark instead of `bookmark-default-handler'. The handler should | 471 | bookmark instead of `bookmark-default-handler'. The handler should |
| @@ -489,17 +487,20 @@ this name." | |||
| 489 | ;; already existing bookmark under that name and | 487 | ;; already existing bookmark under that name and |
| 490 | ;; no prefix arg means just overwrite old bookmark | 488 | ;; no prefix arg means just overwrite old bookmark |
| 491 | (setcdr (bookmark-get-bookmark stripped-name) | 489 | (setcdr (bookmark-get-bookmark stripped-name) |
| 492 | (list (funcall bookmark-make-record-function annotation))) | 490 | (list (funcall bookmark-make-record-function))) |
| 493 | 491 | ||
| 494 | ;; otherwise just cons it onto the front (either the bookmark | 492 | ;; otherwise just cons it onto the front (either the bookmark |
| 495 | ;; doesn't exist already, or there is no prefix arg. In either | 493 | ;; doesn't exist already, or there is no prefix arg. In either |
| 496 | ;; case, we want the new bookmark consed onto the alist...) | 494 | ;; case, we want the new bookmark consed onto the alist...) |
| 497 | 495 | ||
| 498 | (setq bookmark-alist | 496 | (push (list stripped-name |
| 499 | (cons | 497 | (funcall bookmark-make-record-function)) |
| 500 | (list stripped-name | 498 | bookmark-alist)) |
| 501 | (funcall bookmark-make-record-function annotation)) | 499 | |
| 502 | bookmark-alist))) | 500 | (when annotation |
| 501 | ;; Take no chances with text properties. | ||
| 502 | (set-text-properties 0 (length annotation) nil annotation) | ||
| 503 | (bookmark-prop-set stripped-name 'annotation annotation)) | ||
| 503 | 504 | ||
| 504 | ;; Added by db | 505 | ;; Added by db |
| 505 | (setq bookmark-current-bookmark stripped-name) | 506 | (setq bookmark-current-bookmark stripped-name) |
| @@ -509,37 +510,24 @@ this name." | |||
| 509 | (bookmark-save)))) | 510 | (bookmark-save)))) |
| 510 | 511 | ||
| 511 | 512 | ||
| 512 | (defun bookmark-make-record-for-text-file (annotation) | 513 | (defun bookmark-make-record-for-text-file () |
| 513 | "Return the record part of a new bookmark, given ANNOTATION. | 514 | "Return the record describing the location of a new bookmark. |
| 514 | Must be at the correct position in the buffer in which the bookmark is | 515 | Must be at the correct position in the buffer in which the bookmark is |
| 515 | being set (this might change someday)." | 516 | being set (this might change someday)." |
| 516 | (let ((the-record | 517 | `((filename . ,(bookmark-buffer-file-name)) |
| 517 | `((filename . ,(bookmark-buffer-file-name)) | 518 | (front-context-string |
| 518 | (front-context-string | 519 | . ,(if (>= (- (point-max) (point)) bookmark-search-size) |
| 519 | . ,(if (>= (- (point-max) (point)) bookmark-search-size) | 520 | (buffer-substring-no-properties |
| 520 | (buffer-substring-no-properties | 521 | (point) |
| 521 | (point) | 522 | (+ (point) bookmark-search-size)) |
| 522 | (+ (point) bookmark-search-size)) | 523 | nil)) |
| 523 | nil)) | 524 | (rear-context-string |
| 524 | (rear-context-string | 525 | . ,(if (>= (- (point) (point-min)) bookmark-search-size) |
| 525 | . ,(if (>= (- (point) (point-min)) bookmark-search-size) | 526 | (buffer-substring-no-properties |
| 526 | (buffer-substring-no-properties | 527 | (point) |
| 527 | (point) | 528 | (- (point) bookmark-search-size)) |
| 528 | (- (point) bookmark-search-size)) | 529 | nil)) |
| 529 | nil)) | 530 | (position . ,(point)))) |
| 530 | (position . ,(point))))) | ||
| 531 | |||
| 532 | ;; Now fill in the optional parts: | ||
| 533 | |||
| 534 | ;; Take no chances with text properties | ||
| 535 | (set-text-properties 0 (length annotation) nil annotation) | ||
| 536 | |||
| 537 | (if annotation | ||
| 538 | (nconc the-record (list (cons 'annotation annotation)))) | ||
| 539 | |||
| 540 | ;; Finally, return the completed record. | ||
| 541 | the-record)) | ||
| 542 | |||
| 543 | 531 | ||
| 544 | 532 | ||
| 545 | ;;; File format stuff | 533 | ;;; 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." | |||
| 1082 | 1082 | ||
| 1083 | ;;;; Bookmark integration | 1083 | ;;;; Bookmark integration |
| 1084 | 1084 | ||
| 1085 | (defun doc-view-bookmark-make-record (annotation) | 1085 | (defun doc-view-bookmark-make-record () |
| 1086 | (let ((the-record | 1086 | `((filename . ,buffer-file-name) |
| 1087 | `((filename . ,buffer-file-name) | 1087 | (page . ,(doc-view-current-page)) |
| 1088 | (page . ,(doc-view-current-page)) | 1088 | (handler . doc-view-bookmark-jump))) |
| 1089 | (handler . doc-view-bookmark-jump)))) | ||
| 1090 | |||
| 1091 | ;; Take no chances with text properties | ||
| 1092 | (set-text-properties 0 (length annotation) nil annotation) | ||
| 1093 | |||
| 1094 | (when annotation | ||
| 1095 | (nconc the-record (list (cons 'annotation annotation)))) | ||
| 1096 | |||
| 1097 | ;; Finally, return the completed record. | ||
| 1098 | the-record)) | ||
| 1099 | 1089 | ||
| 1100 | 1090 | ||
| 1101 | (declare-function bookmark-get-filename "bookmark" (bookmark)) | 1091 | (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." | |||
| 4336 | (if file Info-current-file Info-current-node)) | 4336 | (if file Info-current-file Info-current-node)) |
| 4337 | 4337 | ||
| 4338 | 4338 | ||
| 4339 | (defun Info-bookmark-make-record (annotation) | 4339 | (defun Info-bookmark-make-record () |
| 4340 | (let ((the-record | 4340 | `((filename . ,(bookmark-buffer-file-name)) |
| 4341 | `((filename . ,(bookmark-buffer-file-name)) | 4341 | (front-context-string |
| 4342 | (front-context-string | 4342 | . ,(if (>= (- (point-max) (point)) bookmark-search-size) |
| 4343 | . ,(if (>= (- (point-max) (point)) bookmark-search-size) | 4343 | (buffer-substring-no-properties |
| 4344 | (buffer-substring-no-properties | 4344 | (point) |
| 4345 | (point) | 4345 | (+ (point) bookmark-search-size)) |
| 4346 | (+ (point) bookmark-search-size)) | 4346 | nil)) |
| 4347 | nil)) | 4347 | (rear-context-string |
| 4348 | (rear-context-string | 4348 | . ,(if (>= (- (point) (point-min)) bookmark-search-size) |
| 4349 | . ,(if (>= (- (point) (point-min)) bookmark-search-size) | 4349 | (buffer-substring-no-properties |
| 4350 | (buffer-substring-no-properties | 4350 | (point) |
| 4351 | (point) | 4351 | (- (point) bookmark-search-size)) |
| 4352 | (- (point) bookmark-search-size)) | 4352 | nil)) |
| 4353 | nil)) | 4353 | (info-node . ,Info-current-node) |
| 4354 | (info-node . ,Info-current-node) | 4354 | (handler . Info-bookmark-jump))) |
| 4355 | (handler . Info-bookmark-jump)))) | ||
| 4356 | |||
| 4357 | ;; Now fill in the optional parts: | ||
| 4358 | |||
| 4359 | ;; Take no chances with text properties | ||
| 4360 | (set-text-properties 0 (length annotation) nil annotation) | ||
| 4361 | |||
| 4362 | (if annotation | ||
| 4363 | (nconc the-record (list (cons 'annotation annotation)))) | ||
| 4364 | |||
| 4365 | ;; Finally, return the completed record. | ||
| 4366 | the-record)) | ||
| 4367 | 4355 | ||
| 4368 | 4356 | ||
| 4369 | (defvar bookmark-current-bookmark) | 4357 | (defvar bookmark-current-bookmark) |