X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/086add1519b5c5a69a1a35aadbfd4d7cc6a2b294..d9ca64a98d02f5a3d196896b9f48c39e69e73d44:/lisp/image-mode.el diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 4999a880df..1a55676e3c 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -1,6 +1,6 @@ ;;; image-mode.el --- support for visiting image files ;; -;; Copyright (C) 2005 Free Software Foundation, Inc. +;; Copyright (C) 2005, 2006 Free Software Foundation, Inc. ;; ;; Author: Richard Stallman ;; Keywords: multimedia @@ -66,7 +66,7 @@ to toggle between display as an image and display as text." ;; variables were cleared by kill-all-local-variables (setq cursor-type nil truncate-lines t)) (run-mode-hooks 'image-mode-hook) - (message (concat (substitute-command-keys + (message "%s" (concat (substitute-command-keys "Type \\[image-toggle-display] to view the image as ") (if (get-text-property (point-min) 'display) "text" "an image") "."))) @@ -84,7 +84,7 @@ See the command `image-mode' for more information on this mode." (if (get-text-property (point-min) 'display) (setq cursor-type nil truncate-lines t)) (add-hook 'change-major-mode-hook (lambda () (image-minor-mode -1)) nil t) - (message (concat (substitute-command-keys + (message "%s" (concat (substitute-command-keys "Type \\[image-toggle-display] to view the image as ") (if (get-text-property (point-min) 'display) "text" "an image") ".")))) @@ -137,11 +137,19 @@ and showing the image as an image." (message "Repeat this command to go back to displaying the image"))) ;; Turn the image data into a real image, but only if the whole file ;; was inserted - (let* ((data - (string-make-unibyte - (buffer-substring-no-properties (point-min) (point-max)))) - (image - (create-image data nil t)) + (let* ((image + (if (and (buffer-file-name) + (not (buffer-modified-p)) + (not (and (boundp 'archive-superior-buffer) + archive-superior-buffer)) + (not (and (boundp 'tar-superior-buffer) + tar-superior-buffer))) + (progn (clear-image-cache) + (create-image (buffer-file-name))) + (create-image + (string-make-unibyte + (buffer-substring-no-properties (point-min) (point-max))) + nil t))) (props `(display ,image intangible ,image