From 97666703e977cbc1b2ddf3da2a7c06747d5c4f66 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 5 Feb 2009 23:59:52 +0000 Subject: [PATCH] (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. --- lisp/ChangeLog | 7 +++++++ 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 @@ +2009-02-05 Juri Linkov + + * image-mode.el (image-mode): Use `image-get-display-property' + instead of `get-text-property'. + (image-minor-mode): Sync the logic with `image-mode' including the + displaying an image file as the actual image by default. + 2009-02-05 Alan Mackenzie * 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." (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) (if (display-images-p) - (if (not (get-text-property (point-min) 'display)) + (if (not (image-get-display-property)) (image-toggle-display) ;; Set next vars when image is already displayed but local ;; variables were cleared by kill-all-local-variables @@ -357,15 +357,20 @@ See the command `image-mode' for more information on this mode." :version "22.1" (if (not image-minor-mode) (image-toggle-display-text) - (if (image-get-display-property) - (setq cursor-type nil truncate-lines t) - (setq image-type "text")) (image-mode-setup-winprops) (add-hook 'change-major-mode-hook (lambda () (image-minor-mode -1)) nil t) - (message "%s" (concat (substitute-command-keys - "Type \\[image-toggle-display] to view the image as ") - (if (image-get-display-property) - "text" "an image") ".")))) + (if (display-images-p) + (if (not (image-get-display-property)) + (image-toggle-display) + (setq cursor-type nil truncate-lines t)) + (setq image-type "text") + (use-local-map image-mode-text-map)) + (if (display-images-p) + (message "%s" (concat + (substitute-command-keys + "Type \\[image-toggle-display] to view the image as ") + (if (image-get-display-property) + "text" "an image") "."))))) ;;;###autoload (defun image-mode-maybe () @@ -465,7 +470,7 @@ and showing the image as an image." (setq mode-name (format "Image[%s]" type))) (if (called-interactively-p) (message "Repeat this command to go back to displaying the file as text"))))) - + ;;; Support for bookmark.el (declare-function bookmark-make-record-default "bookmark" (&optional point-only)) @@ -477,8 +482,6 @@ and showing the image as an image." `((image-type . ,image-type) (handler . image-bookmark-jump)))) - - ;;;###autoload (defun image-bookmark-jump (bmk) ;; This implements the `handler' function interface for record type @@ -486,7 +489,7 @@ and showing the image as an image." (prog1 (bookmark-default-handler bmk) (when (not (string= image-type (bookmark-prop-get bmk 'image-type))) (image-toggle-display)))) - + (provide 'image-mode) ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb