summaryrefslogtreecommitdiff
path: root/lisp/select.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-05-05 12:32:58 +0800
committerChong Yidong <cyd@gnu.org>2012-05-05 12:32:58 +0800
commiteceeb5fca618f3bc0743c2388148dd758229c7c9 (patch)
tree314434b14014363326ec7ce2868c3b86af4d97c3 /lisp/select.el
parent248da2f497e8865e8bebb0e3adb9184ab36e95f2 (diff)
parentbe4e7c155b6922dd6105f4be57164210c3441f37 (diff)
downloademacs-eceeb5fca618f3bc0743c2388148dd758229c7c9.tar.gz
Merge from emacs-24; up to 2012-04-20T05:47:55Z!eliz@gnu.org
Diffstat (limited to 'lisp/select.el')
-rw-r--r--lisp/select.el42
1 files changed, 24 insertions, 18 deletions
diff --git a/lisp/select.el b/lisp/select.el
index 3948fcc5456..d3153a0ce0e 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -228,24 +228,30 @@ two markers or an overlay. Otherwise, it is nil."
;; But avoid modifying the string if it's a buffer name etc.
(unless can-modify (setq str (substring str 0)))
(remove-text-properties 0 (length str) '(composition nil) str)
- ;; TEXT is a polymorphic target. Select the actual type
- ;; from `UTF8_STRING', `COMPOUND_TEXT', `STRING', and
- ;; `C_STRING'.
- (if (eq type 'TEXT)
- (if (not (multibyte-string-p str))
- (setq type 'C_STRING)
- (let (non-latin-1 non-unicode eight-bit)
- (mapc #'(lambda (x)
- (if (>= x #x100)
- (if (< x #x110000)
- (setq non-latin-1 t)
- (if (< x #x3FFF80)
- (setq non-unicode t)
- (setq eight-bit t)))))
- str)
- (setq type (if non-unicode 'COMPOUND_TEXT
- (if non-latin-1 'UTF8_STRING
- (if eight-bit 'C_STRING 'STRING)))))))
+ ;; For X selections, TEXT is a polymorphic target; choose
+ ;; the actual type from `UTF8_STRING', `COMPOUND_TEXT',
+ ;; `STRING', and `C_STRING'. On Nextstep, always use UTF-8
+ ;; (see ns_string_to_pasteboard_internal in nsselect.m).
+ (when (eq type 'TEXT)
+ (cond
+ ((featurep 'ns)
+ (setq type 'UTF8_STRING))
+ ((not (multibyte-string-p str))
+ (setq type 'C_STRING))
+ (t
+ (let (non-latin-1 non-unicode eight-bit)
+ (mapc #'(lambda (x)
+ (if (>= x #x100)
+ (if (< x #x110000)
+ (setq non-latin-1 t)
+ (if (< x #x3FFF80)
+ (setq non-unicode t)
+ (setq eight-bit t)))))
+ str)
+ (setq type (if non-unicode 'COMPOUND_TEXT
+ (if non-latin-1 'UTF8_STRING
+ (if eight-bit 'C_STRING
+ 'STRING))))))))
(cond
((eq type 'UTF8_STRING)
(if (or (not coding)