Re: Uppercase character predicate
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
> From: Stephen Berman <[email protected]> > Cc: Nikolaos Chatzikonstantinou <[email protected]>, [email protected] > Date: Fri, 14 Aug 2026 13:48:34 +0200 > > On Fri, 14 Aug 2026 14:28:29 +0300 Eli Zaretskii <[email protected]> wrote: > > >> From: Nikolaos Chatzikonstantinou <[email protected]> > >> Date: Thu, 13 Aug 2026 23:08:40 -0400 > >> > >> Hello list, > >> > >> I tried using the `char-uppercase-p' with the MATHEMATICAL FRAKTUR > >> CAPITAL A character (unicode #x1d504) but it evaluated to nil. I > >> peeked through `describe-char' to see how it comes up with the > >> description above (since I can use it to detect if a character is > >> capital) and I came up with this: > >> > >> (defun my/upcase-p (ch) > >> "Check if CH is uppercase. > >> > >> Slower, but more accurate than `char-uppercase-p'." > >> (string-match-p "CAPITAL" > >> (get-char-code-property ch 'name))) > >> > >> This function works for my needs, but why doesn't `char-uppercase-p' > >> evaluate to true for this character? > > > > Because Emacs considers a character to be uppercase only if there's a > > corresponding lowercase character which makes the upper-/lower-case > > pair. And MATHEMATICAL FRAKTUR CAPITAL A doesn't have a corresponding > > lowercase character. > > Why doesn't MATHEMATICAL FRAKTUR SMALL A (#x1d51e) fit that bill? > > (get-char-code-property #x1d504 'general-category) => Lu > (get-char-code-property #x1d51e 'general-category) => Ll Because Unicode database doesn't specify them as a case pair.