Re: Uppercase character predicate

Nikolaos Chatzikonstantinou <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <CAAQmekd2oCdhhw+Bn=KW7bVPaExJ9-UZP2CmidsRt_DQyPRz6Q@mail.gmail.com>
On Fri, Aug 14, 2026 at 10:22 AM Eli Zaretskii <[email protected]> wrote:
>
> > 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.

Some more details in
<https://www.unicode.org/faq/casemap_charprop.html#casemap>.  I think
that I understood the issue: the character is considered only as a
math symbol by Unicode, not an alphabet letter. (I also use them only
as math symbols.)

PS. Thanks for that code snippet Eli!
PPS. I accidentally sent 2 e-mails to some recipients.

-- 
Regards,
Nikolaos Chatzikonstantinou
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.