APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1316628855 -3600
# Node ID 5273dd66a1ba89ab11a42f5297eb26efd441b301
# Parent 6c76f5b7e2e3e77d6a7c4a21507032a2adae439e
Strip extent information when passing text to external programs, select.el
lisp/ChangeLog addition:
2011-09-21 Aidan Kehoe <kehoea(a)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.
diff -r 6c76f5b7e2e3 -r 5273dd66a1ba lisp/ChangeLog
--- a/lisp/ChangeLog Sun Sep 11 16:05:05 2011 +0100
+++ b/lisp/ChangeLog Wed Sep 21 19:14:15 2011 +0100
@@ -1,3 +1,14 @@
+2011-09-21 Aidan Kehoe <kehoea(a)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.
+
2011-09-11 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-macs.el (cl-defsubst-expand):
diff -r 6c76f5b7e2e3 -r 5273dd66a1ba lisp/select.el
--- 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)
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches