]> code.delx.au - gnu-emacs/commitdiff
(image-minor-mode): Set `cursor-type' and `truncate-lines' if the
authorJuri Linkov <juri@jurta.org>
Fri, 25 Mar 2005 21:45:47 +0000 (21:45 +0000)
committerJuri Linkov <juri@jurta.org>
Fri, 25 Mar 2005 21:45:47 +0000 (21:45 +0000)
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.

lisp/ChangeLog
lisp/image-mode.el

index a58694f447f2fd7390113c08baf45b0c3430e090..99796ca77ae0daf6f9e0498965c18277fa8ac579 100644 (file)
        (image-toggle-display): Use called-interactively-p.
        Let-bind `inhibit-read-only' to t.
 
-       * image-file.el (image-file-name-extensions): Remove .xbm and .xpm
-       associated with c-mode in `auto-mode-alist'.
+       * image-mode.el (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.
 
 2005-03-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index c955a43214805d7d5c4f8e0a3ca579448007a339..b29027fcf4248ddcf7b37ae21142ae172f080c95 100644 (file)
@@ -79,8 +79,15 @@ See the command `image-mode' for more information on this mode."
   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 ()