changeset 97114:b9d3eb039500

Set image-mode-text-map when image cannot be displayed.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 30 Jul 2008 13:35:50 +0000
parents ec3dfb53a046
children 9880fe3905f7
files lisp/image-mode.el
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/image-mode.el	Wed Jul 30 13:34:24 2008 +0000
+++ b/lisp/image-mode.el	Wed Jul 30 13:35:50 2008 +0000
@@ -290,11 +290,9 @@
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
     (define-key map "q"         'quit-window)
-    ;;
     (define-key map "\C-c\C-c" 'image-toggle-display)
     (define-key map (kbd "SPC")       'image-scroll-up)
     (define-key map (kbd "DEL")       'image-scroll-down)
-    ;;
     (define-key map [remap forward-char] 'image-forward-hscroll)
     (define-key map [remap backward-char] 'image-backward-hscroll)
     (define-key map [remap previous-line] 'image-previous-line)
@@ -333,13 +331,14 @@
   (image-mode-setup-winprops)
 
   (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t)
-  (if (and (display-images-p)
-	   (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
-    (use-local-map image-mode-map)
-    (setq cursor-type nil truncate-lines t))
+  (if (display-images-p)
+      (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
+	(use-local-map image-mode-map)
+	(setq cursor-type nil truncate-lines t))
+    (use-local-map image-mode-text-map))
   (run-mode-hooks 'image-mode-hook)
   (if (display-images-p)
       (message "%s" (concat