diff options
| author | Chong Yidong | 2006-01-30 20:44:44 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-01-30 20:44:44 +0000 |
| commit | 2bd53dc0718af4f3184d213f096bde5bbcc46a90 (patch) | |
| tree | ec8a0d1446c04240124137773b2cce20b6c002ad | |
| parent | c45c309fe28b83f7ab0c59ea225084374c783931 (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/image-mode.el | 13 |
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 @@ | |||
| 1 | 2006-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 | |||
| 1 | 2006-01-30 John Paul Wallington <jpw@pobox.com> | 6 | 2006-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 |