Mercurial > emacs
comparison lisp/image-file.el @ 90203:187d6a1f84f7
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-71
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 485-492)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 92-94)
- Merge from emacs--cvs-trunk--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 22 Jul 2005 08:27:27 +0000 |
parents | f9a65d7ebd29 a0c4a6096f55 |
children | 890cc78a5a24 |
comparison
equal
deleted
inserted
replaced
90202:7597b4a23c3b | 90203:187d6a1f84f7 |
---|---|
116 (buffer-substring-no-properties ibeg iend))) | 116 (buffer-substring-no-properties ibeg iend))) |
117 (image | 117 (image |
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 intangible ,image | 122 intangible ,image |
122 rear-nonsticky (display intangible) | 123 rear-nonsticky (display intangible) |
123 ;; This a cheap attempt to make the whole buffer | 124 ;; This a cheap attempt to make the whole buffer |
124 ;; read-only when we're visiting the file (as | 125 ;; read-only when we're visiting the file (as |
125 ;; opposed to just inserting it). | 126 ;; opposed to just inserting it). |
133 ;; This just makes the arrow displayed in the right fringe | 134 ;; This just makes the arrow displayed in the right fringe |
134 ;; area look correct when the image is wider than the window. | 135 ;; area look correct when the image is wider than the window. |
135 (setq truncate-lines t)))) | 136 (setq truncate-lines t)))) |
136 rval)) | 137 rval)) |
137 | 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 | |
138 (put 'image-file-handler 'safe-magic t) | 152 (put 'image-file-handler 'safe-magic t) |
139 (defun image-file-handler (operation &rest args) | 153 (defun image-file-handler (operation &rest args) |
140 "Filename handler for inserting image files. | 154 "Filename handler for inserting image files. |
141 OPERATION is the operation to perform, on ARGS. | 155 OPERATION is the operation to perform, on ARGS. |
142 See `file-name-handler-alist' for details." | 156 See `file-name-handler-alist' for details." |