diff options
| author | Karl Fogel | 2008-03-07 05:44:37 +0000 |
|---|---|---|
| committer | Karl Fogel | 2008-03-07 05:44:37 +0000 |
| commit | e0385bf41a6e719c988e3bf07eacb45f02a65287 (patch) | |
| tree | 7a6b75d193ea692481e1567bdec82b1102ad7592 | |
| parent | 360bc6282cca18f01c04205c7dbcedd1d679ef3b (diff) | |
| download | emacs-e0385bf41a6e719c988e3bf07eacb45f02a65287.tar.gz emacs-e0385bf41a6e719c988e3bf07eacb45f02a65287.zip | |
Change a return type, for greater extensibility. See
http://lists.gnu.org/archive/html/emacs-devel/2007-12/msg01077.html
and its thread for discussion leading to this change.
* emacs-cvs/lisp/bookmark.el:
(bookmark-jump-noselect): Return an alist instead of a dotted pair.
(bookmark-jump, bookmark-jump-other-window, bookmark-insert)
(bookmark-bmenu-2-window, bookmark-bmenu-other-window)
(bookmark-bmenu-switch-other-window): Adjust accordingly.
(bookmark-make-cell-function): Adjust documentation accordingly.
* emacs-cvs/lisp/image-mode.el
(image-bookmark-jump): Adjust return type accordingly; document.
* emacs-cvs/lisp/doc-view.el
(doc-view-bookmark-jump): Adjust return type accordingly; document.
| -rw-r--r-- | lisp/ChangeLog | 24 | ||||
| -rw-r--r-- | lisp/bookmark.el | 30 | ||||
| -rw-r--r-- | lisp/doc-view.el | 10 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/gnus-bookmark.el | 10 | ||||
| -rw-r--r-- | lisp/image-mode.el | 10 | ||||
| -rw-r--r-- | lisp/info.el | 10 |
7 files changed, 65 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cefab268ec9..c7b263783b5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2008-03-07 Karl Fogel <kfogel@red-bean.com> | ||
| 2 | |||
| 3 | Give a better name to part of the bookmark interface. | ||
| 4 | |||
| 5 | This was originally a much larger change, but halfway through I | ||
| 6 | updated and discovered that Stefan Monnier had done the rest. | ||
| 7 | It looks like he anticipated the new name too, because he used | ||
| 8 | `the-record' instead of `the-cell' for some internal variable names. | ||
| 9 | |||
| 10 | * lisp/bookmark.el | ||
| 11 | (bookmark-make-record-function): Was `bookmark-make-cell-function'. | ||
| 12 | (bookmark-make, bookmark-send-annotation): Update for above. | ||
| 13 | (bookmark-make-record-for-text-file): Was | ||
| 14 | `bookmark-make-cell-for-text-file. Fix doc string re 2008-03-07T05:00:18Z!monnier@iro.umontreal.ca. | ||
| 15 | |||
| 16 | * lisp/info.el: Adjust accordingly. | ||
| 17 | (Info-bookmark-make-record): Was `Info-bookmark-make-cell'. | ||
| 18 | |||
| 19 | * lisp/image-mode.el: Adjust accordingly. | ||
| 20 | (image-bookmark-make-record): Was `image-bookmark-make-cell'. | ||
| 21 | |||
| 22 | * lisp/doc-view.el: Adjust accordingly. | ||
| 23 | (doc-view-bookmark-make-record): Was `doc-view-bookmark-make-cell'. | ||
| 24 | |||
| 1 | 2008-03-07 Stefan Monnier <monnier@iro.umontreal.ca> | 25 | 2008-03-07 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 26 | ||
| 3 | * bookmark.el (bookmark-map, bookmark-read-annotation-mode-map): | 27 | * bookmark.el (bookmark-map, bookmark-read-annotation-mode-map): |
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 13595b64635..9badaed7f12 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el | |||
| @@ -463,13 +463,14 @@ menus, so `completing-read' never gets a chance to set `bookmark-history'." | |||
| 463 | (interactive-p) | 463 | (interactive-p) |
| 464 | (setq bookmark-history (cons ,string bookmark-history)))) | 464 | (setq bookmark-history (cons ,string bookmark-history)))) |
| 465 | 465 | ||
| 466 | (defvar bookmark-make-cell-function 'bookmark-make-cell-for-text-file | 466 | (defvar bookmark-make-record-function 'bookmark-make-record-for-text-file |
| 467 | "A function that should be called to create the bookmark | 467 | "A function that should be called to create a bookmark record. |
| 468 | record. Modes may set this variable buffer-locally to enable | 468 | Modes may set this variable buffer-locally to enable bookmarking of |
| 469 | bookmarking of non-text files like images or pdf documents. | 469 | locations that should be treated specially, such as Info nodes, |
| 470 | news posts, images, pdf documents, etc. | ||
| 470 | 471 | ||
| 471 | The function will be called with one argument: ANNOTATION. | 472 | The function will be called with one argument: ANNOTATION. |
| 472 | See `bookmark-make-cell-for-text-file' for a description. | 473 | See `bookmark-make-record-for-text-file' for a description. |
| 473 | 474 | ||
| 474 | The returned record may contain a special cons (handler . SOME-FUNCTION) | 475 | The returned record may contain a special cons (handler . SOME-FUNCTION) |
| 475 | which sets the handler function that should be used to open this | 476 | which sets the handler function that should be used to open this |
| @@ -492,7 +493,7 @@ this name." | |||
| 492 | ;; already existing bookmark under that name and | 493 | ;; already existing bookmark under that name and |
| 493 | ;; no prefix arg means just overwrite old bookmark | 494 | ;; no prefix arg means just overwrite old bookmark |
| 494 | (setcdr (bookmark-get-bookmark stripped-name) | 495 | (setcdr (bookmark-get-bookmark stripped-name) |
| 495 | (list (funcall bookmark-make-cell-function annotation))) | 496 | (list (funcall bookmark-make-record-function annotation))) |
| 496 | 497 | ||
| 497 | ;; otherwise just cons it onto the front (either the bookmark | 498 | ;; otherwise just cons it onto the front (either the bookmark |
| 498 | ;; doesn't exist already, or there is no prefix arg. In either | 499 | ;; doesn't exist already, or there is no prefix arg. In either |
| @@ -501,7 +502,7 @@ this name." | |||
| 501 | (setq bookmark-alist | 502 | (setq bookmark-alist |
| 502 | (cons | 503 | (cons |
| 503 | (list stripped-name | 504 | (list stripped-name |
| 504 | (funcall bookmark-make-cell-function annotation)) | 505 | (funcall bookmark-make-record-function annotation)) |
| 505 | bookmark-alist))) | 506 | bookmark-alist))) |
| 506 | 507 | ||
| 507 | ;; Added by db | 508 | ;; Added by db |
| @@ -512,12 +513,10 @@ this name." | |||
| 512 | (bookmark-save)))) | 513 | (bookmark-save)))) |
| 513 | 514 | ||
| 514 | 515 | ||
| 515 | (defun bookmark-make-cell-for-text-file (annotation) | 516 | (defun bookmark-make-record-for-text-file (annotation) |
| 516 | "Return the record part of a new bookmark, given ANNOTATION. | 517 | "Return the record part of a new bookmark, given ANNOTATION. |
| 517 | Must be at the correct position in the buffer in which the bookmark is | 518 | Must be at the correct position in the buffer in which the bookmark is |
| 518 | being set. This might change someday. | 519 | being set (this might change someday)." |
| 519 | Optional second arg INFO-NODE means this bookmark is at info node | ||
| 520 | INFO-NODE, so record this fact in the bookmark's entry." | ||
| 521 | (let ((the-record | 520 | (let ((the-record |
| 522 | `((filename . ,(bookmark-buffer-file-name)) | 521 | `((filename . ,(bookmark-buffer-file-name)) |
| 523 | (front-context-string | 522 | (front-context-string |
| @@ -807,11 +806,12 @@ the bookmark (and file, and point) specified in buffer local variables." | |||
| 807 | (bookmark bookmark-annotation-name) | 806 | (bookmark bookmark-annotation-name) |
| 808 | (pt bookmark-annotation-point) | 807 | (pt bookmark-annotation-point) |
| 809 | (buf bookmark-annotation-buffer)) | 808 | (buf bookmark-annotation-buffer)) |
| 810 | ;; for bookmark-make-cell to work, we need to be | 809 | ;; for bookmark-make-record-function to work, we need to be |
| 811 | ;; in the relevant buffer, at the relevant point. | 810 | ;; in the relevant buffer, at the relevant point. |
| 812 | ;; Actually, bookmark-make-cell should probably be re-written, | 811 | ;; Actually, the bookmark-make-record-function spec should |
| 813 | ;; to avoid this need. Should I handle the error if a buffer is | 812 | ;; probably be changed to avoid this need. Should I handle the |
| 814 | ;; killed between "C-x r m" and a "C-c C-c" in the annotation buffer? | 813 | ;; error if a buffer is killed between "C-x r m" and a "C-c C-c" |
| 814 | ;; in the annotation buffer? | ||
| 815 | (save-excursion | 815 | (save-excursion |
| 816 | (pop-to-buffer buf) | 816 | (pop-to-buffer buf) |
| 817 | (goto-char pt) | 817 | (goto-char pt) |
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 50338423218..56ad20c0c41 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -969,7 +969,7 @@ If BACKWARD is non-nil, jump to the previous match." | |||
| 969 | (file-name-extension doc-view-buffer-file-name)" files is missing. " | 969 | (file-name-extension doc-view-buffer-file-name)" files is missing. " |
| 970 | "Type \\[doc-view-toggle-display] to switch to an editing mode."))))) | 970 | "Type \\[doc-view-toggle-display] to switch to an editing mode."))))) |
| 971 | 971 | ||
| 972 | (defvar bookmark-make-cell-function) | 972 | (defvar bookmark-make-record-function) |
| 973 | 973 | ||
| 974 | (defun doc-view-clone-buffer-hook () | 974 | (defun doc-view-clone-buffer-hook () |
| 975 | ;; FIXME: There are several potential problems linked with reconversion | 975 | ;; FIXME: There are several potential problems linked with reconversion |
| @@ -1046,8 +1046,8 @@ toggle between displaying the document or editing it as text. | |||
| 1046 | (set (make-local-variable 'cursor-type) nil) | 1046 | (set (make-local-variable 'cursor-type) nil) |
| 1047 | (use-local-map doc-view-mode-map) | 1047 | (use-local-map doc-view-mode-map) |
| 1048 | (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc) | 1048 | (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc) |
| 1049 | (set (make-local-variable 'bookmark-make-cell-function) | 1049 | (set (make-local-variable 'bookmark-make-record-function) |
| 1050 | 'doc-view-bookmark-make-cell) | 1050 | 'doc-view-bookmark-make-record) |
| 1051 | (setq mode-name "DocView" | 1051 | (setq mode-name "DocView" |
| 1052 | buffer-read-only t | 1052 | buffer-read-only t |
| 1053 | major-mode 'doc-view-mode) | 1053 | major-mode 'doc-view-mode) |
| @@ -1082,7 +1082,7 @@ 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-cell (annotation &rest args) | 1085 | (defun doc-view-bookmark-make-record (annotation &rest args) |
| 1086 | (let ((the-record | 1086 | (let ((the-record |
| 1087 | `((filename . ,buffer-file-name) | 1087 | `((filename . ,buffer-file-name) |
| 1088 | (page . ,(doc-view-current-page)) | 1088 | (page . ,(doc-view-current-page)) |
| @@ -1104,7 +1104,7 @@ See the command `doc-view-mode' for more information on this mode." | |||
| 1104 | ;;;###autoload | 1104 | ;;;###autoload |
| 1105 | (defun doc-view-bookmark-jump (bmk) | 1105 | (defun doc-view-bookmark-jump (bmk) |
| 1106 | ;; This implements the `handler' function interface for record type | 1106 | ;; This implements the `handler' function interface for record type |
| 1107 | ;; returned by `bookmark-make-cell-function', which see. | 1107 | ;; returned by `doc-view-bookmark-make-record', which see. |
| 1108 | (save-window-excursion | 1108 | (save-window-excursion |
| 1109 | (let ((filename (bookmark-get-filename bmk)) | 1109 | (let ((filename (bookmark-get-filename bmk)) |
| 1110 | (page (cdr (assq 'page (bookmark-get-bookmark-record bmk))))) | 1110 | (page (cdr (assq 'page (bookmark-get-bookmark-record bmk))))) |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 16647a5b10f..d71fcb0e73c 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2008-03-07 Karl Fogel <kfogel@red-bean.com> | ||
| 2 | |||
| 3 | * lisp/gnus/gnus-bookmark.el: Adjust for renames in bookmark.el. | ||
| 4 | (gnus-bookmark-make-record): Was `gnus-bookmark-make-cell'. | ||
| 5 | (gnus-bookmark-jump): Adjust some variable names. | ||
| 6 | |||
| 1 | 2008-03-05 Glenn Morris <rgm@gnu.org> | 7 | 2008-03-05 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * gnus-art.el (gnus-article-mode-line-format-alist): Move to gnus-sum. | 9 | * gnus-art.el (gnus-article-mode-line-format-alist): Move to gnus-sum. |
diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el index 6b0bfebbabc..41b124e697a 100644 --- a/lisp/gnus/gnus-bookmark.el +++ b/lisp/gnus/gnus-bookmark.el | |||
| @@ -207,13 +207,13 @@ So the cdr of each bookmark is an alist too.") | |||
| 207 | (setq gnus-bookmark-alist | 207 | (setq gnus-bookmark-alist |
| 208 | (cons | 208 | (cons |
| 209 | (list (gnus-bookmark-remove-properties bmk-name) | 209 | (list (gnus-bookmark-remove-properties bmk-name) |
| 210 | (gnus-bookmark-make-cell | 210 | (gnus-bookmark-make-record |
| 211 | group message-id author date subject annotation)) | 211 | group message-id author date subject annotation)) |
| 212 | gnus-bookmark-alist)))) | 212 | gnus-bookmark-alist)))) |
| 213 | (gnus-bookmark-bmenu-surreptitiously-rebuild-list) | 213 | (gnus-bookmark-bmenu-surreptitiously-rebuild-list) |
| 214 | (gnus-bookmark-write-file)) | 214 | (gnus-bookmark-write-file)) |
| 215 | 215 | ||
| 216 | (defun gnus-bookmark-make-cell | 216 | (defun gnus-bookmark-make-record |
| 217 | (group message-id author date subject annotation) | 217 | (group message-id author date subject annotation) |
| 218 | "Return the record part of a new bookmark, given GROUP MESSAGE-ID AUTHOR DATE SUBJECT and ANNOTATION." | 218 | "Return the record part of a new bookmark, given GROUP MESSAGE-ID AUTHOR DATE SUBJECT and ANNOTATION." |
| 219 | (let ((the-record | 219 | (let ((the-record |
| @@ -288,9 +288,9 @@ So the cdr of each bookmark is an alist too.") | |||
| 288 | (let* ((bookmark (or bmk-name | 288 | (let* ((bookmark (or bmk-name |
| 289 | (completing-read "Jump to bookmarked article: " | 289 | (completing-read "Jump to bookmarked article: " |
| 290 | gnus-bookmark-alist))) | 290 | gnus-bookmark-alist))) |
| 291 | (bmk-cell (cadr (assoc bookmark gnus-bookmark-alist))) | 291 | (bmk-record (cadr (assoc bookmark gnus-bookmark-alist))) |
| 292 | (group (cdr (assoc 'group bmk-cell))) | 292 | (group (cdr (assoc 'group bmk-record))) |
| 293 | (message-id (cdr (assoc 'message-id bmk-cell)))) | 293 | (message-id (cdr (assoc 'message-id bmk-record)))) |
| 294 | (when group | 294 | (when group |
| 295 | (unless (get-buffer gnus-group-buffer) | 295 | (unless (get-buffer gnus-group-buffer) |
| 296 | (gnus-no-server)) | 296 | (gnus-no-server)) |
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 23d9aff737d..9a78cb28407 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -278,7 +278,7 @@ This variable is used to display the current image type in the mode line.") | |||
| 278 | map) | 278 | map) |
| 279 | "Major mode keymap for viewing images as text in Image mode.") | 279 | "Major mode keymap for viewing images as text in Image mode.") |
| 280 | 280 | ||
| 281 | (defvar bookmark-make-cell-function) | 281 | (defvar bookmark-make-record-function) |
| 282 | 282 | ||
| 283 | ;;;###autoload | 283 | ;;;###autoload |
| 284 | (defun image-mode () | 284 | (defun image-mode () |
| @@ -290,8 +290,8 @@ to toggle between display as an image and display as text." | |||
| 290 | (setq mode-name "Image[text]") | 290 | (setq mode-name "Image[text]") |
| 291 | (setq major-mode 'image-mode) | 291 | (setq major-mode 'image-mode) |
| 292 | ;; Use our own bookmarking function for images. | 292 | ;; Use our own bookmarking function for images. |
| 293 | (set (make-local-variable 'bookmark-make-cell-function) | 293 | (set (make-local-variable 'bookmark-make-record-function) |
| 294 | 'image-bookmark-make-cell) | 294 | 'image-bookmark-make-record) |
| 295 | 295 | ||
| 296 | ;; Keep track of [vh]scroll when switching buffers | 296 | ;; Keep track of [vh]scroll when switching buffers |
| 297 | (image-mode-setup-winprops) | 297 | (image-mode-setup-winprops) |
| @@ -431,7 +431,7 @@ and showing the image as an image." | |||
| 431 | 431 | ||
| 432 | ;;; Support for bookmark.el | 432 | ;;; Support for bookmark.el |
| 433 | 433 | ||
| 434 | (defun image-bookmark-make-cell (annotation &rest args) | 434 | (defun image-bookmark-make-record (annotation &rest args) |
| 435 | (let ((the-record | 435 | (let ((the-record |
| 436 | `((filename . ,(buffer-file-name)) | 436 | `((filename . ,(buffer-file-name)) |
| 437 | (image-type . ,image-type) | 437 | (image-type . ,image-type) |
| @@ -454,7 +454,7 @@ and showing the image as an image." | |||
| 454 | ;;;###autoload | 454 | ;;;###autoload |
| 455 | (defun image-bookmark-jump (bmk) | 455 | (defun image-bookmark-jump (bmk) |
| 456 | ;; This implements the `handler' function interface for record type | 456 | ;; This implements the `handler' function interface for record type |
| 457 | ;; returned by `bookmark-make-cell-function', which see. | 457 | ;; returned by `bookmark-make-record-function', which see. |
| 458 | (save-window-excursion | 458 | (save-window-excursion |
| 459 | (let ((filename (bookmark-get-filename bmk)) | 459 | (let ((filename (bookmark-get-filename bmk)) |
| 460 | (type (cdr (assq 'image-type (bookmark-get-bookmark-record bmk)))) | 460 | (type (cdr (assq 'image-type (bookmark-get-bookmark-record bmk)))) |
diff --git a/lisp/info.el b/lisp/info.el index d85c0df8b17..4fc63035dc6 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -3374,7 +3374,7 @@ With a zero prefix arg, put the name inside a function call to `info'." | |||
| 3374 | (put 'Info-mode 'no-clone-indirect t) | 3374 | (put 'Info-mode 'no-clone-indirect t) |
| 3375 | 3375 | ||
| 3376 | (defvar tool-bar-map) | 3376 | (defvar tool-bar-map) |
| 3377 | (defvar bookmark-make-cell-function) | 3377 | (defvar bookmark-make-record-function) |
| 3378 | 3378 | ||
| 3379 | ;; Autoload cookie needed by desktop.el | 3379 | ;; Autoload cookie needed by desktop.el |
| 3380 | ;;;###autoload | 3380 | ;;;###autoload |
| @@ -3487,8 +3487,8 @@ Advanced commands: | |||
| 3487 | (set (make-local-variable 'revert-buffer-function) | 3487 | (set (make-local-variable 'revert-buffer-function) |
| 3488 | 'Info-revert-buffer-function) | 3488 | 'Info-revert-buffer-function) |
| 3489 | (Info-set-mode-line) | 3489 | (Info-set-mode-line) |
| 3490 | (set (make-local-variable 'bookmark-make-cell-function) | 3490 | (set (make-local-variable 'bookmark-make-record-function) |
| 3491 | 'Info-bookmark-make-cell) | 3491 | 'Info-bookmark-make-record) |
| 3492 | (run-mode-hooks 'Info-mode-hook)) | 3492 | (run-mode-hooks 'Info-mode-hook)) |
| 3493 | 3493 | ||
| 3494 | ;; When an Info buffer is killed, make sure the associated tags buffer | 3494 | ;; When an Info buffer is killed, make sure the associated tags buffer |
| @@ -4326,7 +4326,7 @@ BUFFER is the buffer speedbar is requesting buttons for." | |||
| 4326 | ;; This is only called from bookmark.el. | 4326 | ;; This is only called from bookmark.el. |
| 4327 | (declare-function bookmark-buffer-file-name "bookmark" ()) | 4327 | (declare-function bookmark-buffer-file-name "bookmark" ()) |
| 4328 | 4328 | ||
| 4329 | (defun Info-bookmark-make-cell (annotation &rest args) | 4329 | (defun Info-bookmark-make-record (annotation &rest args) |
| 4330 | (let ((the-record | 4330 | (let ((the-record |
| 4331 | `((filename . ,(bookmark-buffer-file-name)) | 4331 | `((filename . ,(bookmark-buffer-file-name)) |
| 4332 | (front-context-string | 4332 | (front-context-string |
| @@ -4368,7 +4368,7 @@ BUFFER is the buffer speedbar is requesting buttons for." | |||
| 4368 | ;;;###autoload | 4368 | ;;;###autoload |
| 4369 | (defun Info-bookmark-jump (bmk) | 4369 | (defun Info-bookmark-jump (bmk) |
| 4370 | ;; This implements the `handler' function interface for record type returned | 4370 | ;; This implements the `handler' function interface for record type returned |
| 4371 | ;; by `Info-make-cell-function', which see. | 4371 | ;; by `Info-bookmark-make-record', which see. |
| 4372 | (let* ((file (expand-file-name (bookmark-get-filename bmk))) | 4372 | (let* ((file (expand-file-name (bookmark-get-filename bmk))) |
| 4373 | (forward-str (bookmark-get-front-context-string bmk)) | 4373 | (forward-str (bookmark-get-front-context-string bmk)) |
| 4374 | (behind-str (bookmark-get-rear-context-string bmk)) | 4374 | (behind-str (bookmark-get-rear-context-string bmk)) |