]> git.eshelyaron.com Git - emacs.git/commitdiff
Teach 'max-char' about the Unicode code range
authorEli Zaretskii <eliz@gnu.org>
Sat, 3 Sep 2022 10:45:53 +0000 (13:45 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 3 Sep 2022 10:45:53 +0000 (13:45 +0300)
* 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'.

doc/lispref/nonascii.texi
etc/NEWS
lisp/emacs-lisp/comp.el
src/character.c

index 6dc23637a79d564957a6872fc011d87c5040929d..71fee45c4a525aa5947ed5d9be4cd39ba45e55e7 100644 (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
index 8269d3e7bf39edf6b462b4d8984c5f6618f8925a..cc4714e71ce63b9a096c3577ae9ebef42827e014 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
 
 ---
index e10443588e4ba118569566089ff043717733e117..306ec918b1a1267c3da84d69e7e0a31673abab8e 100644 (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))
index 968daccafa78ca3e56761bda1abcb61b657c774f..dc21649b226b351535ca5beea82f029832fdf62a 100644 (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,