- (image-toggle-display-text)
- (message "%s" (concat
- (substitute-command-keys
- "Type \\[image-toggle-display] to view the image as ")
- (if (image-get-display-property)
- "text" "an image") "."))))
+ (image-toggle-display-text)))
+
+(defun image-mode-as-hex ()
+ "Set a non-image mode as major mode in combination with image minor mode.
+A non-mage major mode found from `auto-mode-alist' or fundamental mode
+displays an image file as hex. `image-minor-mode' provides the key
+\\<image-mode-map>\\[image-toggle-hex-display] to switch back to `image-mode'
+to display an image file as the actual image.
+
+You can use `image-mode-as-hex' in `auto-mode-alist' when you want to
+to display an image file as hex initially.
+
+See commands `image-mode' and `image-minor-mode' for more information
+on these modes."
+ (interactive)
+ (image-mode-to-text)
+ ;; Turn on hexl-mode
+ (hexl-mode)
+ (message "%s" (concat
+ (substitute-command-keys
+ "Type \\[image-toggle-hex-display] or \\[image-toggle-display] to view the image as ")
+ (if (image-get-display-property)
+ "hex" "an image or text") ".")))
+
+(defun image-mode-as-text ()
+ "Set a non-image mode as major mode in combination with image minor mode.
+A non-image major mode found from `auto-mode-alist' or Fundamental mode
+displays an image file as text. `image-minor-mode' provides the key
+\\<image-mode-map>\\[image-toggle-display] to switch back to `image-mode'
+to display an image file as the actual image.
+
+You can use `image-mode-as-text' in `auto-mode-alist' when you want
+to display an image file as text initially.
+
+See commands `image-mode' and `image-minor-mode' for more information
+on these modes."
+ (interactive)
+ (image-mode-to-text)
+ (message "%s" (concat
+ (substitute-command-keys
+ "Type \\[image-toggle-display] or \\[image-toggle-hex-display] to view the image as ")
+ (if (image-get-display-property)
+ "text" "an image or hex") ".")))