comparison lisp/image-mode.el @ 72568:02a05917de2a

* image-mode.el (image-mode): Display image as text on a terminal.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 28 Aug 2006 22:49:25 +0000
parents 3c0fceee4b4a
children 7011a586dd45
comparison
equal deleted inserted replaced
72567:b562a18db094 72568:02a05917de2a
58 (kill-all-local-variables) 58 (kill-all-local-variables)
59 (setq mode-name "Image") 59 (setq mode-name "Image")
60 (setq major-mode 'image-mode) 60 (setq major-mode 'image-mode)
61 (use-local-map image-mode-map) 61 (use-local-map image-mode-map)
62 (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t) 62 (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t)
63 (if (not (get-text-property (point-min) 'display)) 63 (let ((image-display-supported-p (memq window-system '(x w32 mac))))
64 (image-toggle-display) 64 (if (and image-display-supported-p
65 ;; Set next vars when image is already displayed but local 65 (not (get-text-property (point-min) 'display)))
66 ;; variables were cleared by kill-all-local-variables 66 (image-toggle-display)
67 (setq cursor-type nil truncate-lines t)) 67 ;; Set next vars when image is already displayed but local
68 (run-mode-hooks 'image-mode-hook) 68 ;; variables were cleared by kill-all-local-variables
69 (message "%s" (concat (substitute-command-keys 69 (setq cursor-type nil truncate-lines t))
70 "Type \\[image-toggle-display] to view the image as ") 70 (run-mode-hooks 'image-mode-hook)
71 (if (get-text-property (point-min) 'display) 71 (if image-display-supported-p
72 "text" "an image") "."))) 72 (message "%s" (concat
73 (substitute-command-keys
74 "Type \\[image-toggle-display] to view the image as ")
75 (if (get-text-property (point-min) 'display)
76 "text" "an image") ".")))))
73 77
74 ;;;###autoload 78 ;;;###autoload
75 (define-minor-mode image-minor-mode 79 (define-minor-mode image-minor-mode
76 "Toggle Image minor mode. 80 "Toggle Image minor mode.
77 With arg, turn Image minor mode on if arg is positive, off otherwise. 81 With arg, turn Image minor mode on if arg is positive, off otherwise.