diff options
| -rw-r--r-- | lisp/subr.el | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 45decd63924..6668f6423d6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2167,11 +2167,32 @@ If UNDO is present and non-nil, it is a function that will be called | |||
| 2167 | (let* ((handler (and (stringp string) | 2167 | (let* ((handler (and (stringp string) |
| 2168 | (get-text-property 0 'yank-handler string))) | 2168 | (get-text-property 0 'yank-handler string))) |
| 2169 | (param (or (nth 1 handler) string)) | 2169 | (param (or (nth 1 handler) string)) |
| 2170 | (opoint (point))) | 2170 | (opoint (point)) |
| 2171 | end) | ||
| 2172 | |||
| 2171 | (setq yank-undo-function t) | 2173 | (setq yank-undo-function t) |
| 2172 | (if (nth 0 handler) ;; FUNCTION | 2174 | (if (nth 0 handler) ;; FUNCTION |
| 2173 | (funcall (car handler) param) | 2175 | (funcall (car handler) param) |
| 2174 | (insert param)) | 2176 | (insert param)) |
| 2177 | (setq end (point)) | ||
| 2178 | |||
| 2179 | ;; What should we do with `font-lock-face' properties? | ||
| 2180 | (if font-lock-defaults | ||
| 2181 | ;; No, just wipe them. | ||
| 2182 | (remove-list-of-text-properties opoint end '(font-lock-face)) | ||
| 2183 | ;; Convert them to `face'. | ||
| 2184 | (save-excursion | ||
| 2185 | (goto-char opoint) | ||
| 2186 | (while (< (point) end) | ||
| 2187 | (let ((face (get-text-property (point) 'font-lock-face)) | ||
| 2188 | run-end) | ||
| 2189 | (setq run-end | ||
| 2190 | (next-single-property-change (point) 'font-lock-face nil end)) | ||
| 2191 | (when face | ||
| 2192 | (remove-text-properties (point) run-end '(font-lock-face nil)) | ||
| 2193 | (put-text-property (point) run-end 'face face)) | ||
| 2194 | (goto-char run-end))))) | ||
| 2195 | |||
| 2175 | (unless (nth 2 handler) ;; NOEXCLUDE | 2196 | (unless (nth 2 handler) ;; NOEXCLUDE |
| 2176 | (remove-yank-excluded-properties opoint (point))) | 2197 | (remove-yank-excluded-properties opoint (point))) |
| 2177 | (if (eq yank-undo-function t) ;; not set by FUNCTION | 2198 | (if (eq yank-undo-function t) ;; not set by FUNCTION |