diff options
| author | Juri Linkov | 2009-02-05 23:59:52 +0000 |
|---|---|---|
| committer | Juri Linkov | 2009-02-05 23:59:52 +0000 |
| commit | 97666703e977cbc1b2ddf3da2a7c06747d5c4f66 (patch) | |
| tree | 1998df53024ae288021e2de20bd62f6d9d5f0c21 | |
| parent | 5aa4315c5572dcaead7281f0d02f4161679ff068 (diff) | |
| download | emacs-97666703e977cbc1b2ddf3da2a7c06747d5c4f66.tar.gz emacs-97666703e977cbc1b2ddf3da2a7c06747d5c4f66.zip | |
(image-mode): Use `image-get-display-property' instead of `get-text-property'.
(image-minor-mode): Sync the logic with `image-mode' including the
activation of the image display by default.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/image-mode.el | 27 |
2 files changed, 22 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 88f7bbc4292..43671d0f6e2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2009-02-05 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * image-mode.el (image-mode): Use `image-get-display-property' | ||
| 4 | instead of `get-text-property'. | ||
| 5 | (image-minor-mode): Sync the logic with `image-mode' including the | ||
| 6 | displaying an image file as the actual image by default. | ||
| 7 | |||
| 1 | 2009-02-05 Alan Mackenzie <acm@muc.de> | 8 | 2009-02-05 Alan Mackenzie <acm@muc.de> |
| 2 | 9 | ||
| 3 | * progmodes/cc-defs.el (c-emacs-features): Check the working of | 10 | * progmodes/cc-defs.el (c-emacs-features): Check the working of |
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 8cdf22a0724..638f2516741 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -332,7 +332,7 @@ to toggle between display as an image and display as text." | |||
| 332 | 332 | ||
| 333 | (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) | 333 | (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) |
| 334 | (if (display-images-p) | 334 | (if (display-images-p) |
| 335 | (if (not (get-text-property (point-min) 'display)) | 335 | (if (not (image-get-display-property)) |
| 336 | (image-toggle-display) | 336 | (image-toggle-display) |
| 337 | ;; Set next vars when image is already displayed but local | 337 | ;; Set next vars when image is already displayed but local |
| 338 | ;; variables were cleared by kill-all-local-variables | 338 | ;; variables were cleared by kill-all-local-variables |
| @@ -357,15 +357,20 @@ See the command `image-mode' for more information on this mode." | |||
| 357 | :version "22.1" | 357 | :version "22.1" |
| 358 | (if (not image-minor-mode) | 358 | (if (not image-minor-mode) |
| 359 | (image-toggle-display-text) | 359 | (image-toggle-display-text) |
| 360 | (if (image-get-display-property) | ||
| 361 | (setq cursor-type nil truncate-lines t) | ||
| 362 | (setq image-type "text")) | ||
| 363 | (image-mode-setup-winprops) | 360 | (image-mode-setup-winprops) |
| 364 | (add-hook 'change-major-mode-hook (lambda () (image-minor-mode -1)) nil t) | 361 | (add-hook 'change-major-mode-hook (lambda () (image-minor-mode -1)) nil t) |
| 365 | (message "%s" (concat (substitute-command-keys | 362 | (if (display-images-p) |
| 366 | "Type \\[image-toggle-display] to view the image as ") | 363 | (if (not (image-get-display-property)) |
| 367 | (if (image-get-display-property) | 364 | (image-toggle-display) |
| 368 | "text" "an image") ".")))) | 365 | (setq cursor-type nil truncate-lines t)) |
| 366 | (setq image-type "text") | ||
| 367 | (use-local-map image-mode-text-map)) | ||
| 368 | (if (display-images-p) | ||
| 369 | (message "%s" (concat | ||
| 370 | (substitute-command-keys | ||
| 371 | "Type \\[image-toggle-display] to view the image as ") | ||
| 372 | (if (image-get-display-property) | ||
| 373 | "text" "an image") "."))))) | ||
| 369 | 374 | ||
| 370 | ;;;###autoload | 375 | ;;;###autoload |
| 371 | (defun image-mode-maybe () | 376 | (defun image-mode-maybe () |
| @@ -465,7 +470,7 @@ and showing the image as an image." | |||
| 465 | (setq mode-name (format "Image[%s]" type))) | 470 | (setq mode-name (format "Image[%s]" type))) |
| 466 | (if (called-interactively-p) | 471 | (if (called-interactively-p) |
| 467 | (message "Repeat this command to go back to displaying the file as text"))))) | 472 | (message "Repeat this command to go back to displaying the file as text"))))) |
| 468 | 473 | ||
| 469 | ;;; Support for bookmark.el | 474 | ;;; Support for bookmark.el |
| 470 | (declare-function bookmark-make-record-default "bookmark" | 475 | (declare-function bookmark-make-record-default "bookmark" |
| 471 | (&optional point-only)) | 476 | (&optional point-only)) |
| @@ -477,8 +482,6 @@ and showing the image as an image." | |||
| 477 | `((image-type . ,image-type) | 482 | `((image-type . ,image-type) |
| 478 | (handler . image-bookmark-jump)))) | 483 | (handler . image-bookmark-jump)))) |
| 479 | 484 | ||
| 480 | |||
| 481 | |||
| 482 | ;;;###autoload | 485 | ;;;###autoload |
| 483 | (defun image-bookmark-jump (bmk) | 486 | (defun image-bookmark-jump (bmk) |
| 484 | ;; This implements the `handler' function interface for record type | 487 | ;; This implements the `handler' function interface for record type |
| @@ -486,7 +489,7 @@ and showing the image as an image." | |||
| 486 | (prog1 (bookmark-default-handler bmk) | 489 | (prog1 (bookmark-default-handler bmk) |
| 487 | (when (not (string= image-type (bookmark-prop-get bmk 'image-type))) | 490 | (when (not (string= image-type (bookmark-prop-get bmk 'image-type))) |
| 488 | (image-toggle-display)))) | 491 | (image-toggle-display)))) |
| 489 | 492 | ||
| 490 | (provide 'image-mode) | 493 | (provide 'image-mode) |
| 491 | 494 | ||
| 492 | ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb | 495 | ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb |