Mercurial > emacs
comparison lisp/image.el @ 29607:42d156d8d8eb
(insert-image): Save a little consing.
author | Dave Love <fx@gnu.org> |
---|---|
date | Mon, 12 Jun 2000 20:34:36 +0000 |
parents | 7bde123bed95 |
children | 7c53a907cce4 |
comparison
equal
deleted
inserted
replaced
29606:f16690808171 | 29607:42d156d8d8eb |
---|---|
149 (unless string (setq string "x")) | 149 (unless string (setq string "x")) |
150 (unless (eq (car-safe image) 'image) | 150 (unless (eq (car-safe image) 'image) |
151 (error "Not an image: %s" image)) | 151 (error "Not an image: %s" image)) |
152 (unless (or (null area) (memq area '(left-margin right-margin))) | 152 (unless (or (null area) (memq area '(left-margin right-margin))) |
153 (error "Invalid area %s" area)) | 153 (error "Invalid area %s" area)) |
154 (when area | 154 (if area |
155 (setq image (list (list 'margin area) image))) | 155 (setq image (list (list 'margin area) image)) |
156 ;; Cons up a new spec equal but not eq to `image' so that | |
157 ;; inserting it twice in a row (adjacently) displays two copies of | |
158 ;; the image. Don't try to avoid this by looking at the display | |
159 ;; properties on either side so that we DTRT more often with | |
160 ;; cut-and-paste. (Yanking killed image text next to another copy | |
161 ;; of it loses anyway.) | |
162 (setq image (cons 'image (cdr image)))) | |
156 (let ((start (point))) | 163 (let ((start (point))) |
157 (insert string) | 164 (insert string) |
158 ;; Copy `image' so that inserting it twice in a row (adjacently) | |
159 ;; displays two copies of the image. | |
160 (add-text-properties start (point) | 165 (add-text-properties start (point) |
161 (list 'display (copy-sequence image) | 166 (list 'display image |
162 'intangible (list t) ; something unique | 167 ;; `image' has the right properties to |
168 ;; mark an intangible field. | |
169 'intangible image | |
163 'rear-nonsticky (list 'display))))) | 170 'rear-nonsticky (list 'display))))) |
164 | 171 |
165 | 172 |
166 ;;;###autoload | 173 ;;;###autoload |
167 (defun remove-images (start end &optional buffer) | 174 (defun remove-images (start end &optional buffer) |