aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2009-11-28 20:45:19 +0000
committerStefan Monnier2009-11-28 20:45:19 +0000
commit26224fafa0c504defeff50909e887ea48b06353b (patch)
tree8d4538bdb483ee7c065a2d82d077e8f699beeb81
parentc6d47315357bc8a1e2345d6d941d136debe58b36 (diff)
downloademacs-26224fafa0c504defeff50909e887ea48b06353b.tar.gz
emacs-26224fafa0c504defeff50909e887ea48b06353b.zip
(image-minor-mode): Exit more gracefully when the image
cannot be displayed (e.g. when doing C-x C-f some-new-file.svg RET).
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/image-mode.el30
2 files changed, 22 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 62f2dc5f4b5..39a55c525cc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12009-11-28 Stefan Monnier <monnier@iro.umontreal.ca> 12009-11-28 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * image-mode.el (image-minor-mode): Exit more gracefully when the image
4 cannot be displayed (e.g. when doing C-x C-f some-new-file.svg RET).
5
3 * man.el (Man-completion-table): Make it easier to enter "<sec> <name>". 6 * man.el (Man-completion-table): Make it easier to enter "<sec> <name>".
4 7
5 * eshell/em-prompt.el (eshell-prompt-function): Abbreviate pwd, since 8 * eshell/em-prompt.el (eshell-prompt-function): Abbreviate pwd, since
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index bb97eb8e0b5..2351edc934c 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -362,18 +362,26 @@ See the command `image-mode' for more information on this mode."
362 (image-mode-setup-winprops) 362 (image-mode-setup-winprops)
363 (add-hook 'change-major-mode-hook (lambda () (image-minor-mode -1)) nil t) 363 (add-hook 'change-major-mode-hook (lambda () (image-minor-mode -1)) nil t)
364 (if (display-images-p) 364 (if (display-images-p)
365 (if (not (image-get-display-property)) 365 (condition-case err
366 (image-toggle-display) 366 (progn
367 (setq cursor-type nil truncate-lines t 367 (if (not (image-get-display-property))
368 image-type (plist-get (cdr (image-get-display-property)) :type))) 368 (image-toggle-display)
369 (setq cursor-type nil truncate-lines t
370 image-type (plist-get (cdr (image-get-display-property))
371 :type)))
372 (message "%s"
373 (concat
374 (substitute-command-keys
375 "Type \\[image-toggle-display] to view the image as ")
376 (if (image-get-display-property)
377 "text" "an image") ".")))
378 (error
379 (image-toggle-display-text)
380 (funcall
381 (if (called-interactively-p 'any) 'error 'message)
382 "Cannot display image: %s" (cdr err))))
369 (setq image-type "text") 383 (setq image-type "text")
370 (use-local-map image-mode-text-map)) 384 (use-local-map image-mode-text-map))))
371 (if (display-images-p)
372 (message "%s" (concat
373 (substitute-command-keys
374 "Type \\[image-toggle-display] to view the image as ")
375 (if (image-get-display-property)
376 "text" "an image") ".")))))
377 385
378;;;###autoload 386;;;###autoload
379(defun image-mode-maybe () 387(defun image-mode-maybe ()