Merge from origin/emacs-30

1a8fbf69e3 Fix 'whitespace-mode' in CJK locales
01c03043e6 ; Improve documentation of 'gui-get-selection' use on X
This commit is contained in:
Eli Zaretskii 2025-03-15 09:22:51 -04:00
commit 9e670088c7
3 changed files with 25 additions and 8 deletions

View file

@ -4161,8 +4161,14 @@ programs. It takes two optional arguments, @var{type} and
The @var{data-type} argument specifies the form of data conversion to
use, to convert the raw data obtained from another program into Lisp
data. @xref{X Selections}, for an enumeration of data types valid under
X, and @pxref{Other Selections} for those elsewhere.
data. It defaults to @code{STRING}. @xref{X Selections}, for an
enumeration of data types valid on X, and @pxref{Other Selections} for
those elsewhere. On X Window system, we recommend to always specify a
particular @var{data-type}, especially if the selection is expected to
be non-ASCII text (in which case Lisp programs should prefer
@code{UTF8_STRING} as the value of @var{data-type}). This is because
the default @var{data-type} value, @code{STRING}, can only support
Latin-1 text, which in many cases is nowadays inadequate.
@end defun
@defopt selection-coding-system

View file

@ -1428,12 +1428,14 @@ with L, LRE, or LRO Unicode bidi character type.")
;; A: East Asian "Ambiguous" characters.
(let ((l '((#x00A1 . #x00A1)
(#x00A4 . #x00A4)
; (#x00A4 . #x00A4) whitespace-mode uses this
(#x00A7 . #x00A8)
(#x00AA . #x00AA)
(#x00AD . #x00AE)
(#x00B0 . #x00B4)
(#x00B6 . #x00BA)
; (#x00B6 . #x00BA) whitespace-mode uses U+00B7
(#x00B6 . #x00B6)
(#x00B8 . #x00BA)
(#x00BC . #x00BF)
(#x00C6 . #x00C6)
(#x00D0 . #x00D0)
@ -1667,6 +1669,10 @@ fonts being used. In some CJK locales the fonts are set so that
these characters are displayed as full-width. This setting is most
important for text-mode frames, because there Emacs cannot access the
metrics of the fonts used by the console or the terminal emulator.
You should configure the terminal emulator to behave consistently
with the value of this option, by making sure it dispays ambiguous-width
characters as half-width or full-width, depending on the value of this
option.
Do not set this directly via `setq'; instead, use `setopt' or the
Customize commands. Alternatively, call `update-cjk-ambiguous-char-widths'

View file

@ -372,10 +372,15 @@ all upper-case names. The most often used ones, in addition to
`PRIMARY', are `SECONDARY' and `CLIPBOARD'.
DATA-TYPE is usually `STRING', but can also be one of the symbols
in `selection-converter-alist', which see. Window systems other
than X usually support only a small subset of these symbols, in
addition to `STRING'; MS-Windows supports `TARGETS', which reports
the formats available in the clipboard if TYPE is `CLIPBOARD'."
in `selection-converter-alist', which see. On X, we recommend
to always use a specific DATA-TYPE expected from the selection
owner. In particular, if the data is expected to be non-ASCII
text, in many cases using \\='UTF8_STRING is the most reasonable
value for DATA-TYPE.
Window systems other than X usually support only a small subset of
these symbols, in addition to `STRING'; MS-Windows supports `TARGETS',
which reports the formats available in the clipboard if TYPE is `CLIPBOARD'."
(let ((data (gui-backend-get-selection (or type 'PRIMARY)
(or data-type 'STRING))))
(when (and (stringp data)