[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ab263a7: (gui-get-selection): Avoid using `string-t
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master ab263a7: (gui-get-selection): Avoid using `string-to-multibyte' |
Date: |
Thu, 16 May 2019 23:42:25 -0400 (EDT) |
branch: master
commit ab263a798076c028812b9a747d6c4206b8090faf
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
(gui-get-selection): Avoid using `string-to-multibyte'
* lisp/select.el (gui-get-selection): Avoid using
`string-to-multibyte' -- instead encode as `eight-bit' if the
string is unibyte.
---
lisp/select.el | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lisp/select.el b/lisp/select.el
index c79e923..3ea741d 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -308,8 +308,15 @@ the formats available in the clipboard if TYPE is
`CLIPBOARD'."
('STRING 'iso-8859-1)
(_ (error "Unknown selection data type: %S"
type))))))
- (setq data (if coding (decode-coding-string data coding)
- (string-to-multibyte data))))
+ (setq data (cond
+ (coding
+ (decode-coding-string data coding))
+ ;; The last two cases are only possible in the
+ ;; C_STRING case.
+ ((multibyte-string-p data)
+ data)
+ (t
+ (encode-coding-string data 'eight-bit)))))
(setq next-selection-coding-system nil)
(put-text-property 0 (length data) 'foreign-selection data-type data))
data))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master ab263a7: (gui-get-selection): Avoid using `string-to-multibyte',
Lars Ingebrigtsen <=