Mercurial > hg > xemacs-beta
diff lisp/select.el @ 5571:5273dd66a1ba
Strip extent information when passing text to external programs, select.el
lisp/ChangeLog addition:
2011-09-21 Aidan Kehoe <kehoea@parhasard.net>
* select.el (select-convert-to-text):
* select.el (select-convert-to-utf-8-text):
Ignore extent information in these functions, other programs can't
do anything useful with it, and it actively interferes when
copying from an ERC buffer to external programs--
#'encode-coding-string complains that the string is read-only,
which is arguably in itself a separate problem, since it allocates
a new string there's no reason for it ever to throw that error.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 21 Sep 2011 19:14:15 +0100 |
parents | ac37a5f7e5be |
children | cc1ec4c93a67 |
line wrap: on
line diff
--- a/lisp/select.el Sun Sep 11 16:05:05 2011 +0100 +++ b/lisp/select.el Wed Sep 21 19:14:15 2011 +0100 @@ -456,14 +456,14 @@ ;; append handlers and buffer-kill handlers. (defun select-convert-to-text (selection type value) (cond ((stringp value) - value) + (substring-no-properties value)) ((extentp value) (save-excursion (set-buffer (extent-object value)) (save-restriction (widen) - (buffer-substring (extent-start-position value) - (extent-end-position value))))) + (buffer-substring-no-properties (extent-start-position value) + (extent-end-position value))))) ((and (consp value) (markerp (car value)) (markerp (cdr value))) @@ -476,7 +476,7 @@ (error "selection is in a killed buffer"))) (save-restriction (widen) - (buffer-substring (car value) (cdr value))))) + (buffer-substring-no-properties (car value) (cdr value))))) (t nil))) (defun select-convert-to-timestamp (selection type value) @@ -485,16 +485,18 @@ (defun select-convert-to-utf-8-text (selection type value) (cond ((stringp value) - (cons 'UTF8_STRING (encode-coding-string value 'utf-8))) + (cons 'UTF8_STRING (encode-coding-string + (substring-no-properties value) 'utf-8))) ((extentp value) (save-excursion (set-buffer (extent-object value)) (save-restriction (widen) (cons 'UTF8_STRING - (encode-coding-string - (buffer-substring (extent-start-position value) - (extent-end-position value)) 'utf-8))))) + (encode-coding-string (buffer-substring-no-properties + (extent-start-position value) + (extent-end-position value)) + 'utf-8))))) ((and (consp value) (markerp (car value)) (markerp (cdr value))) @@ -508,8 +510,8 @@ (save-restriction (widen) (cons 'UTF8_STRING (encode-coding-string - (buffer-substring (car value) (cdr value)) - 'utf-8))))) + (buffer-substring-no-properties + (car value) (cdr value)) 'utf-8))))) (t nil))) (defun select-coerce-to-text (selection type value)