# HG changeset patch # User Chong Yidong # Date 1179788720 0 # Node ID a1b4792efa5e5689abe820675f259abdf4e111ee # Parent 3f89cce8b14c45c6813403770bbf749c3910ae09 (image-toggle-display): Don't clear image cache. Only use filename in image spec if the file is readable. Call image-refresh. diff -r 3f89cce8b14c -r a1b4792efa5e lisp/image-mode.el --- a/lisp/image-mode.el Mon May 21 23:05:09 2007 +0000 +++ b/lisp/image-mode.el Mon May 21 23:05:20 2007 +0000 @@ -144,16 +144,17 @@ (message "Repeat this command to go back to displaying the image"))) ;; Turn the image data into a real image, but only if the whole file ;; was inserted - (let* ((image - (if (and (buffer-file-name) - (not (file-remote-p (buffer-file-name))) + (let* ((filename (buffer-file-name)) + (image + (if (and filename + (file-readable-p filename) + (not (file-remote-p filename)) (not (buffer-modified-p)) (not (and (boundp 'archive-superior-buffer) archive-superior-buffer)) (not (and (boundp 'tar-superior-buffer) tar-superior-buffer))) - (progn (clear-image-cache) - (create-image (buffer-file-name))) + (create-image filename) (create-image (string-make-unibyte (buffer-substring-no-properties (point-min) (point-max))) @@ -169,6 +170,7 @@ (inhibit-read-only t) (buffer-undo-list t) (modified (buffer-modified-p))) + (image-refresh image) (add-text-properties (point-min) (point-max) props) (set-buffer-modified-p modified) ;; Inhibit the cursor when the buffer contains only an image,