1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-04 08:47:11 +00:00

Teach 'max-char' about the Unicode code range

* src/character.c (Fmax_char): Accept an optional argument
UNICODE, and, if non-nil, return the maximum codepoint defined by
Unicode.

* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Update the
signature of 'max-char'.

* etc/NEWS:
* doc/lispref/nonascii.texi (Character Codes): Update the
documentation of 'max-char'.
This commit is contained in:
Eli Zaretskii 2022-09-03 13:45:53 +03:00
parent db2f8b8415
commit dcfe3314cd
4 changed files with 18 additions and 7 deletions

View File

@ -404,9 +404,12 @@ This returns @code{t} if @var{charcode} is a valid character, and
@cindex maximum value of character codepoint
@cindex codepoint, largest value
@defun max-char
@defun max-char &optional unicode
This function returns the largest value that a valid character
codepoint can have.
codepoint can have in Emacs. If the optional argument @var{unicode}
is non-@code{nil}, it returns the largest character codepoint defined
by the Unicode Standard (which is smaller than the maximum codepoint
supported by Emacs).
@example
@group

View File

@ -2789,6 +2789,12 @@ request the name of the ".eln" file which defined a given symbol.
+++
** New macro 'with-memoization' provides a very primitive form of memoization.
+++
** 'max-char' can now report the maximum codepoint according to Unicode.
When called with a new optional argument UNICODE non-nil, 'max-char'
will now report the maximum valid codepoint defined by the Unicode
Standard.
** Themes
---

View File

@ -462,7 +462,7 @@ Useful to hook into pass checkers.")
(marker-buffer (function (marker) (or buffer null)))
(markerp (function (t) boolean))
(max (function ((or number marker) &rest (or number marker)) number))
(max-char (function () fixnum))
(max-char (function (&optional t) fixnum))
(member (function (t list) list))
(memory-limit (function () integer))
(memq (function (t list) list))

View File

@ -178,12 +178,14 @@ usage: (characterp OBJECT) */
return (CHARACTERP (object) ? Qt : Qnil);
}
DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0,
doc: /* Return the character of the maximum code. */
DEFUN ("max-char", Fmax_char, Smax_char, 0, 1, 0,
doc: /* Return the maximum character code.
If UNICODE is non-nil, return the maximum character code defined
by the Unicode Standard. */
attributes: const)
(void)
(Lisp_Object unicode)
{
return make_fixnum (MAX_CHAR);
return unicode ? make_fixnum (MAX_UNICODE_CHAR) : make_fixnum (MAX_CHAR);
}
DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte,