diff options
| author | Kim F. Storm | 2005-07-22 13:11:34 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-07-22 13:11:34 +0000 |
| commit | eab4879567e0b4f4e73b5eda44d2cec1934aef0d (patch) | |
| tree | 74a659aa447eecfa7075b17355ec4e481ac61c04 | |
| parent | 80362dd2c07d1167127036f71716c9fd80c32faa (diff) | |
| download | emacs-eab4879567e0b4f4e73b5eda44d2cec1934aef0d.tar.gz emacs-eab4879567e0b4f4e73b5eda44d2cec1934aef0d.zip | |
(insert-image-file, image-file-yank-handler): Fix
last change to maintain a (unique) yank-handler on yanked images.
| -rw-r--r-- | lisp/image-file.el | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/image-file.el b/lisp/image-file.el index be95470184c..6b88b84e19f 100644 --- a/lisp/image-file.el +++ b/lisp/image-file.el | |||
| @@ -118,7 +118,8 @@ the command `insert-file-contents'." | |||
| 118 | (create-image data nil t)) | 118 | (create-image data nil t)) |
| 119 | (props | 119 | (props |
| 120 | `(display ,image | 120 | `(display ,image |
| 121 | yank-handler (image-file-yank-handler) | 121 | yank-handler |
| 122 | (image-file-yank-handler nil t) | ||
| 122 | intangible ,image | 123 | intangible ,image |
| 123 | rear-nonsticky (display intangible) | 124 | rear-nonsticky (display intangible) |
| 124 | ;; This a cheap attempt to make the whole buffer | 125 | ;; This a cheap attempt to make the whole buffer |
| @@ -141,12 +142,18 @@ the command `insert-file-contents'." | |||
| 141 | ;; recognized as two different images. | 142 | ;; recognized as two different images. |
| 142 | (defun image-file-yank-handler (string) | 143 | (defun image-file-yank-handler (string) |
| 143 | "Yank handler for inserting an image into a buffer." | 144 | "Yank handler for inserting an image into a buffer." |
| 144 | (let ((image (get-text-property 0 'display string))) | 145 | (let ((len (length string)) |
| 146 | (image (get-text-property 0 'display string))) | ||
| 147 | (remove-text-properties 0 len yank-excluded-properties string) | ||
| 145 | (if (consp image) | 148 | (if (consp image) |
| 146 | (put-text-property 0 (length string) | 149 | (add-text-properties 0 |
| 147 | 'display | 150 | (or (next-single-property-change 0 'image-counter string) |
| 148 | (cons (car image) (cdr image)) | 151 | (length string)) |
| 149 | string)) | 152 | `(display |
| 153 | ,(cons (car image) (cdr image)) | ||
| 154 | yank-handler | ||
| 155 | ,(cons 'image-file-yank-handler '(nil t))) | ||
| 156 | string)) | ||
| 150 | (insert string))) | 157 | (insert string))) |
| 151 | 158 | ||
| 152 | (put 'image-file-handler 'safe-magic t) | 159 | (put 'image-file-handler 'safe-magic t) |