changeset 60943:258772850c9a

(image-minor-mode): Set `cursor-type' and `truncate-lines' if the image is already displayed. Add turning image-minor-mode off to `change-major-mode-hook'. Add message. Call `image-toggle-display-text' after turning image-minor-mode off.
author Juri Linkov <juri@jurta.org>
date Fri, 25 Mar 2005 21:44:13 +0000
parents 2dbc6d52cb36
children 22dba20de52e
files lisp/image-mode.el
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/image-mode.el	Fri Mar 25 21:43:05 2005 +0000
+++ b/lisp/image-mode.el	Fri Mar 25 21:44:13 2005 +0000
@@ -79,8 +79,15 @@
   nil " Image" image-mode-map
   :group 'image
   :version "22.1"
-  (unless (or (eq major-mode 'image-mode) image-minor-mode)
-    (use-local-map image-mode-map)))
+  (if (not image-minor-mode)
+      (image-toggle-display-text)
+    (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
+		      "Type \\[image-toggle-display] to view the image as ")
+		     (if (get-text-property (point-min) 'display)
+			 "text" "an image") "."))))
 
 ;;;###autoload
 (defun image-mode-maybe ()