118 |
(create-image data nil t)) |
(create-image data nil t)) |
119 |
(props |
(props |
120 |
`(display ,image |
`(display ,image |
121 |
|
yank-handler (image-file-yank-handler) |
122 |
intangible ,image |
intangible ,image |
123 |
rear-nonsticky (display intangible) |
rear-nonsticky (display intangible) |
124 |
;; This a cheap attempt to make the whole buffer |
;; This a cheap attempt to make the whole buffer |
136 |
(setq truncate-lines t)))) |
(setq truncate-lines t)))) |
137 |
rval)) |
rval)) |
138 |
|
|
139 |
|
;; We use a yank-handler to make yanked images unique, so that |
140 |
|
;; yanking two copies of the same image next to each other are |
141 |
|
;; recognized as two different images. |
142 |
|
(defun image-file-yank-handler (string) |
143 |
|
"Yank handler for inserting an image into a buffer." |
144 |
|
(let ((image (get-text-property 0 'display string))) |
145 |
|
(if (consp image) |
146 |
|
(put-text-property 0 (length string) |
147 |
|
'display |
148 |
|
(cons (car image) (cdr image)) |
149 |
|
string)) |
150 |
|
(insert string))) |
151 |
|
|
152 |
(put 'image-file-handler 'safe-magic t) |
(put 'image-file-handler 'safe-magic t) |
153 |
(defun image-file-handler (operation &rest args) |
(defun image-file-handler (operation &rest args) |
154 |
"Filename handler for inserting image files. |
"Filename handler for inserting image files. |