diff options
| author | Eli Zaretskii | 2022-09-03 13:45:53 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2022-09-03 13:45:53 +0300 |
| commit | dcfe3314cd78e95d992fe00f757ce906d49586cd (patch) | |
| tree | a3b1a37f04592b6db2dd696f3a5df3be6ccb2676 | |
| parent | db2f8b8415b538ccb43f11a2142567ec6c5451d9 (diff) | |
| download | emacs-dcfe3314cd78e95d992fe00f757ce906d49586cd.tar.gz emacs-dcfe3314cd78e95d992fe00f757ce906d49586cd.zip | |
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'.
| -rw-r--r-- | doc/lispref/nonascii.texi | 7 | ||||
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/comp.el | 2 | ||||
| -rw-r--r-- | src/character.c | 10 |
4 files changed, 18 insertions, 7 deletions
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index 6dc23637a79..71fee45c4a5 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi | |||
| @@ -404,9 +404,12 @@ This returns @code{t} if @var{charcode} is a valid character, and | |||
| 404 | 404 | ||
| 405 | @cindex maximum value of character codepoint | 405 | @cindex maximum value of character codepoint |
| 406 | @cindex codepoint, largest value | 406 | @cindex codepoint, largest value |
| 407 | @defun max-char | 407 | @defun max-char &optional unicode |
| 408 | This function returns the largest value that a valid character | 408 | This function returns the largest value that a valid character |
| 409 | codepoint can have. | 409 | codepoint can have in Emacs. If the optional argument @var{unicode} |
| 410 | is non-@code{nil}, it returns the largest character codepoint defined | ||
| 411 | by the Unicode Standard (which is smaller than the maximum codepoint | ||
| 412 | supported by Emacs). | ||
| 410 | 413 | ||
| 411 | @example | 414 | @example |
| 412 | @group | 415 | @group |
| @@ -2789,6 +2789,12 @@ request the name of the ".eln" file which defined a given symbol. | |||
| 2789 | +++ | 2789 | +++ |
| 2790 | ** New macro 'with-memoization' provides a very primitive form of memoization. | 2790 | ** New macro 'with-memoization' provides a very primitive form of memoization. |
| 2791 | 2791 | ||
| 2792 | +++ | ||
| 2793 | ** 'max-char' can now report the maximum codepoint according to Unicode. | ||
| 2794 | When called with a new optional argument UNICODE non-nil, 'max-char' | ||
| 2795 | will now report the maximum valid codepoint defined by the Unicode | ||
| 2796 | Standard. | ||
| 2797 | |||
| 2792 | ** Themes | 2798 | ** Themes |
| 2793 | 2799 | ||
| 2794 | --- | 2800 | --- |
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index e10443588e4..306ec918b1a 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el | |||
| @@ -462,7 +462,7 @@ Useful to hook into pass checkers.") | |||
| 462 | (marker-buffer (function (marker) (or buffer null))) | 462 | (marker-buffer (function (marker) (or buffer null))) |
| 463 | (markerp (function (t) boolean)) | 463 | (markerp (function (t) boolean)) |
| 464 | (max (function ((or number marker) &rest (or number marker)) number)) | 464 | (max (function ((or number marker) &rest (or number marker)) number)) |
| 465 | (max-char (function () fixnum)) | 465 | (max-char (function (&optional t) fixnum)) |
| 466 | (member (function (t list) list)) | 466 | (member (function (t list) list)) |
| 467 | (memory-limit (function () integer)) | 467 | (memory-limit (function () integer)) |
| 468 | (memq (function (t list) list)) | 468 | (memq (function (t list) list)) |
diff --git a/src/character.c b/src/character.c index 968daccafa7..dc21649b226 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -178,12 +178,14 @@ usage: (characterp OBJECT) */ | |||
| 178 | return (CHARACTERP (object) ? Qt : Qnil); | 178 | return (CHARACTERP (object) ? Qt : Qnil); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | DEFUN ("max-char", Fmax_char, Smax_char, 0, 0, 0, | 181 | DEFUN ("max-char", Fmax_char, Smax_char, 0, 1, 0, |
| 182 | doc: /* Return the character of the maximum code. */ | 182 | doc: /* Return the maximum character code. |
| 183 | If UNICODE is non-nil, return the maximum character code defined | ||
| 184 | by the Unicode Standard. */ | ||
| 183 | attributes: const) | 185 | attributes: const) |
| 184 | (void) | 186 | (Lisp_Object unicode) |
| 185 | { | 187 | { |
| 186 | return make_fixnum (MAX_CHAR); | 188 | return unicode ? make_fixnum (MAX_UNICODE_CHAR) : make_fixnum (MAX_CHAR); |
| 187 | } | 189 | } |
| 188 | 190 | ||
| 189 | DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, | 191 | DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, |