diff options
author | Yuuki Harano <masm+github@masm11.me> | 2021-03-02 22:44:42 +0900 |
---|---|---|
committer | Yuuki Harano <masm+github@masm11.me> | 2021-03-02 22:44:42 +0900 |
commit | 565995d408ca65ec9f981f175cca29d2164a5fd0 (patch) | |
tree | 8db7aa64cecf8656f59a9e69d7559d61d9939dd4 /lisp/select.el | |
parent | 436f21eda127882a8408bdc8ae0d398c2cf5aff2 (diff) | |
download | emacs-565995d408ca65ec9f981f175cca29d2164a5fd0.tar.gz |
Fix unicode strings can't be pasted correctly
* lisp/select.el (x-select-request-type): Use text/plain;charset=utf-8
instead.
(gui--selection-value-internal): same.
(gui-get-selection): Treat text/plain;charset=utf-8 as utf-8.
* src/pgtkselect.c (Fpgtk_get_selection_internal): Support
text/plain;charset=utf-8 as foreign-selection.
(syms_of_pgtkselect): Add new symbol.
Diffstat (limited to 'lisp/select.el')
-rw-r--r-- | lisp/select.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/select.el b/lisp/select.el index 5e8a3640238..72f03e76c48 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -140,26 +140,27 @@ MS-Windows does not have a \"primary\" selection." (defcustom x-select-request-type nil "Data type request for X selection. The value is one of the following data types, a list of them, or nil: - `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT', `text/plain' + `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT', `text/plain\\;charset=utf-8' If the value is one of the above symbols, try only the specified type. If the value is a list of them, try each of them in the specified order until succeed. -The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING text/plain)." +The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING +text/plain\\;charset=utf-8)." :type '(choice (const :tag "Default" nil) (const COMPOUND_TEXT) (const UTF8_STRING) (const STRING) (const TEXT) - (const text/plain) + (const text/plain\;charset=utf-8) (set :tag "List of values" (const COMPOUND_TEXT) (const UTF8_STRING) (const STRING) (const TEXT) - (const text/plain))) + (const text/plain\;charset=utf-8))) :group 'killing) (defun gui--selection-value-internal (type) @@ -169,7 +170,7 @@ decided by `x-select-request-type'. The return value is already decoded. If `gui-get-selection' signals an error, return nil." (let ((request-type (if (memq window-system '(x pgtk)) (or x-select-request-type - '(UTF8_STRING COMPOUND_TEXT STRING text/plain)) + '(UTF8_STRING COMPOUND_TEXT STRING text/plain\;charset=utf-8)) 'STRING)) text) (with-demoted-errors "gui-get-selection: %S" @@ -305,6 +306,7 @@ the formats available in the clipboard if TYPE is `CLIPBOARD'." selection-coding-system (pcase data-type ('UTF8_STRING 'utf-8) + ('text/plain\;charset=utf-8 'utf-8) ('COMPOUND_TEXT 'compound-text-with-extensions) ('C_STRING nil) ('STRING 'iso-8859-1) |