From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: case-insensitive string comparison Date: Mon, 25 Jul 2022 23:24:43 -0400 Message-ID: References: <87ilnsq4cr.fsf@gnu.org> Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3409"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: sds@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 26 05:26:12 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oGBD0-0000fX-Kl for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Jul 2022 05:26:10 +0200 Original-Received: from localhost ([::1]:50482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGBCz-00045N-D9 for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Jul 2022 23:26:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGBBc-0002wH-JO for emacs-devel@gnu.org; Mon, 25 Jul 2022 23:24:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59380) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGBBc-0006YV-5j; Mon, 25 Jul 2022 23:24:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=y5o3fm+kWP4cVRiLj6KjOJOlWGTe9TsZG2/0yrne6z4=; b=jos9glAN/9Ky odIN9h1wfNwWBVLuY6DomQSdFhJqqsULBAVF5B1QmkwFiLWIZvYQex4HwXo3gGCvKNI7RUs9hgW6H BTsFi8HdGxabZzp/2FSCElJ/+Zah29LwNir133X2P4NaGuaAUY2nzR6Im7FRmrWQftLMnPu5DLZCm 4aCLjzgHhPOq6ybGz0mdBQ/3ehDm0Ww5+jCbo/IZk594Z+Cc2Fasel9r6CuEwwkqieO0fxDbQBQXX qcZhnogUD6QXx48FosmU196Swe/OEmGE87e3Kq5+xbbxXbqPDLZuFflaq0YNWs3Ly+gnAAZ2gKn40 kYA7pI7m9X8wCy2cw9xq2Q==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1oGBBb-00075O-Tj; Mon, 25 Jul 2022 23:24:43 -0400 In-Reply-To: (message from Sam Steingold on Mon, 25 Jul 2022 10:23:30 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:292664 Archived-At: [[[ 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)