aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2006-01-30 20:44:44 +0000
committerChong Yidong2006-01-30 20:44:44 +0000
commit2bd53dc0718af4f3184d213f096bde5bbcc46a90 (patch)
treeec8a0d1446c04240124137773b2cce20b6c002ad
parentc45c309fe28b83f7ab0c59ea225084374c783931 (diff)
downloademacs-2bd53dc0718af4f3184d213f096bde5bbcc46a90.tar.gz
emacs-2bd53dc0718af4f3184d213f096bde5bbcc46a90.zip
* image-mode.el (image-toggle-display): Use file name if possible,
instead of unnecessarily allocating a (possibly huge) lisp string.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/image-mode.el13
2 files changed, 13 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ca86a0a27b6..5a03a2e8502 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12006-01-30 Chong Yidong <cyd@stupidchicken.com>
2
3 * image-mode.el (image-toggle-display): Use file name if possible,
4 instead of unnecessarily allocating a (possibly huge) lisp string.
5
12006-01-30 John Paul Wallington <jpw@pobox.com> 62006-01-30 John Paul Wallington <jpw@pobox.com>
2 7
3 * subr.el (toplevel): Define `cl-assertion-failed' condition here 8 * subr.el (toplevel): Define `cl-assertion-failed' condition here
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 67d1bcee995..3c0544edf89 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -137,11 +137,14 @@ and showing the image as an image."
137 (message "Repeat this command to go back to displaying the image"))) 137 (message "Repeat this command to go back to displaying the image")))
138 ;; Turn the image data into a real image, but only if the whole file 138 ;; Turn the image data into a real image, but only if the whole file
139 ;; was inserted 139 ;; was inserted
140 (let* ((data 140 (let* ((image
141 (string-make-unibyte 141 (if (and (buffer-file-name)
142 (buffer-substring-no-properties (point-min) (point-max)))) 142 (not (buffer-modified-p)))
143 (image 143 (create-image (buffer-file-name))
144 (create-image data nil t)) 144 (create-image
145 (string-make-unibyte
146 (buffer-substring-no-properties (point-min) (point-max)))
147 nil t)))
145 (props 148 (props
146 `(display ,image 149 `(display ,image
147 intangible ,image 150 intangible ,image