emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case-insensitive string comparison


From: Richard Stallman
Subject: Re: case-insensitive string comparison
Date: Mon, 25 Jul 2022 23:24:43 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > So, how do we do case-insensitive string comparison in Emacs?

Users could do it by calling `compare-strings' directly.

  > It is okay to add a `string-equal-ignore-case' based on `compare-strings'?
  > (even though it does not recognize "SS" and "ß" as equal)

A function `string-equal-ignore-case' would make sense.  My question is,
is it worth the cost in complexity, or is it better to urge users to call
`compare-strings' directly?

That depends on how often programs will do case-insensitive string comparison.
If frequently, that gives a bigger upside to `string-equal-ignore-case'.

  > Or should we first implement something like casefold in Python?
  > https://docs.python.org/3/library/stdtypes.html#str.casefold

That casefold operation is not the same thing as ignoring case in
Emacs.  How to integrate something like that into Emacs, and in
general how to handle `ß' properly in case conversion, calls for more
thought.

It's possible that Python's handling is good, that we should implement
something similar.  It would be useful for people to study that option
including designing how to put it into Emacs, and whether the results
would be problem-free.

Part of the issue is how this should affect the existing case features
including searches in the buffer, case conversion commands and functions,
and `compare-strings'.  Also how it interacts with Turkish.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]