diff options
| author | Dave Love | 2000-06-12 20:36:40 +0000 |
|---|---|---|
| committer | Dave Love | 2000-06-12 20:36:40 +0000 |
| commit | 0dc91c572f0e5dc98f0543d27d0cd71f9b2ac429 (patch) | |
| tree | 371e0d3d7142bd01aadbad502ce140e62dc8c086 | |
| parent | c68833d2cadec9c4ff62040a9e5e2fcfb0099db5 (diff) | |
| download | emacs-0dc91c572f0e5dc98f0543d27d0cd71f9b2ac429.tar.gz emacs-0dc91c572f0e5dc98f0543d27d0cd71f9b2ac429.zip | |
(insert-image): Save a little consing.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/image.el | 19 |
2 files changed, 17 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c3ad921c2b4..a9a821112cc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2000-06-12 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * image.el (insert-image): Save a little consing. | ||
| 4 | |||
| 1 | 2000-06-12 Kenichi Handa <handa@etl.go.jp> | 5 | 2000-06-12 Kenichi Handa <handa@etl.go.jp> |
| 2 | 6 | ||
| 3 | * language/tibet-util.el: Convert all tibetan-1-column characters | 7 | * language/tibet-util.el: Convert all tibetan-1-column characters |
diff --git a/lisp/image.el b/lisp/image.el index 9b04784ec00..339e176c223 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -151,15 +151,22 @@ means display it in the right marginal area." | |||
| 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 | ||