diff options
| author | Tassilo Horn | 2007-12-26 11:48:37 +0000 |
|---|---|---|
| committer | Tassilo Horn | 2007-12-26 11:48:37 +0000 |
| commit | 137187c884c1082d20ee014bc692e8e59734919e (patch) | |
| tree | 0f36817826afde8406ab2bee596d5621a983f423 | |
| parent | 1666a6b3e851967e9b37de28c4c2ece2926a0cf5 (diff) | |
| download | emacs-137187c884c1082d20ee014bc692e8e59734919e.tar.gz emacs-137187c884c1082d20ee014bc692e8e59734919e.zip | |
2007-12-26 Tassilo Horn <tassilo@member.fsf.org>
* image-mode.el (image-bookmark-make-cell, image-bookmark-jump):
New functions.
(image-mode): Set bookmark-make-cell-function appropriately.
* doc-view.el (doc-view-bookmark-jump): Correct misspelled arg
name.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/doc-view.el | 2 | ||||
| -rw-r--r-- | lisp/image-mode.el | 34 |
3 files changed, 42 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 060e932b23c..7dde34cb55d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2007-12-26 Tassilo Horn <tassilo@member.fsf.org> | 1 | 2007-12-26 Tassilo Horn <tassilo@member.fsf.org> |
| 2 | 2 | ||
| 3 | * image-mode.el (image-bookmark-make-cell, image-bookmark-jump): | ||
| 4 | New functions. | ||
| 5 | (image-mode): Set bookmark-make-cell-function appropriately. | ||
| 6 | |||
| 7 | * doc-view.el (doc-view-bookmark-jump): Correct misspelled arg | ||
| 8 | name. | ||
| 9 | |||
| 3 | * bookmark.el (bookmark-make-cell-function): New variable. | 10 | * bookmark.el (bookmark-make-cell-function): New variable. |
| 4 | (bookmark-make): Call bookmark-make-cell-function's function | 11 | (bookmark-make): Call bookmark-make-cell-function's function |
| 5 | instead of bookmark-make-cell. | 12 | instead of bookmark-make-cell. |
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 12b3012448e..388d30b381b 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -1019,7 +1019,7 @@ See the command `doc-view-mode' for more information on this mode." | |||
| 1019 | (defun doc-view-bookmark-jump (bmk) | 1019 | (defun doc-view-bookmark-jump (bmk) |
| 1020 | (save-window-excursion | 1020 | (save-window-excursion |
| 1021 | (let ((filename (bookmark-get-filename bmk)) | 1021 | (let ((filename (bookmark-get-filename bmk)) |
| 1022 | (page (cdr (assq 'page (bookmark-get-bookmark-record bookmark))))) | 1022 | (page (cdr (assq 'page (bookmark-get-bookmark-record bmk))))) |
| 1023 | (find-file filename) | 1023 | (find-file filename) |
| 1024 | (when (not (eq major-mode 'doc-view-mode)) | 1024 | (when (not (eq major-mode 'doc-view-mode)) |
| 1025 | (doc-view-toggle-display)) | 1025 | (doc-view-toggle-display)) |
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 283f6ae3ff1..4041db8ebf2 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -219,6 +219,9 @@ to toggle between display as an image and display as text." | |||
| 219 | (kill-all-local-variables) | 219 | (kill-all-local-variables) |
| 220 | (setq mode-name "Image[text]") | 220 | (setq mode-name "Image[text]") |
| 221 | (setq major-mode 'image-mode) | 221 | (setq major-mode 'image-mode) |
| 222 | ;; Use our own bookmarking function for images. | ||
| 223 | (set (make-local-variable 'bookmark-make-cell-function) | ||
| 224 | 'image-bookmark-make-cell) | ||
| 222 | (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) | 225 | (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) |
| 223 | (if (and (display-images-p) | 226 | (if (and (display-images-p) |
| 224 | (not (get-char-property (point-min) 'display))) | 227 | (not (get-char-property (point-min) 'display))) |
| @@ -352,6 +355,37 @@ and showing the image as an image." | |||
| 352 | (if (called-interactively-p) | 355 | (if (called-interactively-p) |
| 353 | (message "Repeat this command to go back to displaying the file as text"))))) | 356 | (message "Repeat this command to go back to displaying the file as text"))))) |
| 354 | 357 | ||
| 358 | ;;; Support for bookmark.el | ||
| 359 | |||
| 360 | (defun image-bookmark-make-cell (annotation &rest args) | ||
| 361 | (let ((the-record | ||
| 362 | `((filename . ,(buffer-file-name)) | ||
| 363 | (image-type . ,image-type) | ||
| 364 | (position . ,(point)) | ||
| 365 | (handler . image-bookmark-jump)))) | ||
| 366 | |||
| 367 | ;; Take no chances with text properties | ||
| 368 | (set-text-properties 0 (length annotation) nil annotation) | ||
| 369 | |||
| 370 | (when annotation | ||
| 371 | (nconc the-record (list (cons 'annotation annotation)))) | ||
| 372 | |||
| 373 | ;; Finally, return the completed record. | ||
| 374 | the-record)) | ||
| 375 | |||
| 376 | ;;;###autoload | ||
| 377 | (defun image-bookmark-jump (bmk) | ||
| 378 | (save-window-excursion | ||
| 379 | (let ((filename (bookmark-get-filename bmk)) | ||
| 380 | (type (cdr (assq 'image-type (bookmark-get-bookmark-record bmk)))) | ||
| 381 | (pos (bookmark-get-position bmk))) | ||
| 382 | (find-file filename) | ||
| 383 | (when (not (string= image-type type)) | ||
| 384 | (image-toggle-display)) | ||
| 385 | (when (string= image-type "text") | ||
| 386 | (goto-char pos)) | ||
| 387 | (cons (current-buffer) pos)))) | ||
| 388 | |||
| 355 | (provide 'image-mode) | 389 | (provide 'image-mode) |
| 356 | 390 | ||
| 357 | ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb | 391 | ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb |