Mercurial > emacs
comparison lisp/image-mode.el @ 92556:5944be8c8211
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.
author | Karl Fogel <kfogel@red-bean.com> |
---|---|
date | Fri, 07 Mar 2008 05:44:37 +0000 |
parents | a7a0e6010c46 |
children | 2b5ff8c0d207 |
comparison
equal
deleted
inserted
replaced
92555:d238ebc2c1e0 | 92556:5944be8c8211 |
---|---|
276 (let ((map (make-sparse-keymap))) | 276 (let ((map (make-sparse-keymap))) |
277 (define-key map "\C-c\C-c" 'image-toggle-display) | 277 (define-key map "\C-c\C-c" 'image-toggle-display) |
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 () |
285 "Major mode for image files. | 285 "Major mode for image files. |
286 You can use \\<image-mode-map>\\[image-toggle-display] | 286 You can use \\<image-mode-map>\\[image-toggle-display] |
288 (interactive) | 288 (interactive) |
289 (kill-all-local-variables) | 289 (kill-all-local-variables) |
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) |
298 | 298 |
299 (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) | 299 (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) |
429 (if (called-interactively-p) | 429 (if (called-interactively-p) |
430 (message "Repeat this command to go back to displaying the file as text"))))) | 430 (message "Repeat this command to go back to displaying the file as text"))))) |
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) |
438 (position . ,(point)) | 438 (position . ,(point)) |
439 (handler . image-bookmark-jump)))) | 439 (handler . image-bookmark-jump)))) |
452 (declare-function bookmark-get-position "bookmark" (bookmark)) | 452 (declare-function bookmark-get-position "bookmark" (bookmark)) |
453 | 453 |
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)))) |
461 (pos (bookmark-get-position bmk))) | 461 (pos (bookmark-get-position bmk))) |
462 (find-file filename) | 462 (find-file filename) |