From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#54804: 29.0.50; zap-to-char: case sensitive for upper-case letter Date: Sat, 16 Apr 2022 14:33:45 +0300 Message-ID: <834k2t1cva.fsf@gnu.org> References: <87ee27fd1a.fsf@gmail.com> <83bkxaaj45.fsf@gnu.org> <878rs55m81.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4989"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54804@debbugs.gnu.org, uyennhi.qm@gmail.com To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 16 13:34:09 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1nfggr-00015s-Dx for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Apr 2022 13:34:09 +0200 Original-Received: from localhost ([::1]:54408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nfggq-0000bE-6W for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Apr 2022 07:34:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nfggk-0000b4-KU for bug-gnu-emacs@gnu.org; Sat, 16 Apr 2022 07:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nfggk-0000QY-CA for bug-gnu-emacs@gnu.org; Sat, 16 Apr 2022 07:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nfggk-0002ok-8E for bug-gnu-emacs@gnu.org; Sat, 16 Apr 2022 07:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Apr 2022 11:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54804 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 54804-submit@debbugs.gnu.org id=B54804.165010882510807 (code B ref 54804); Sat, 16 Apr 2022 11:34:02 +0000 Original-Received: (at 54804) by debbugs.gnu.org; 16 Apr 2022 11:33:45 +0000 Original-Received: from localhost ([127.0.0.1]:60876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nfggS-0002oF-O3 for submit@debbugs.gnu.org; Sat, 16 Apr 2022 07:33:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nfggQ-0002o1-4U for 54804@debbugs.gnu.org; Sat, 16 Apr 2022 07:33:43 -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 1nfggK-0000NX-Ld; Sat, 16 Apr 2022 07:33:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3xTQlr0X4mKF3Br0eGQL4o31xjPYFgmHyTKpiiWcD8s=; b=BB4xGsHR4xkl IeP2PUnF3zI09Aia3evsYIjtc+zcUjUlpu+bxCJN1VCeJgb4+p38dDDWI1gnZsGSLZ+/jMxnQ+TWu EDPgHJJmVRdWiV5M4Ibu0+hsWY7pcxUbLwXk3Wc+OC+92n60xcYBGT0P+8vGvMBDGb2lpcYbW2uh8 S6/rdLpF3BNRNJ9vzo+5JcAi9DSkpqP1epAN6jVIiY38ywxP1Nky7Gy5pAyFzDktFqv06t5xH+qAS ZPGP6SSwqXGBWRRZIUsGYIPmYVeoewqMEmySLCeJb8VeIEq68eyHG5hDxdvU8rKnl6X4tCZmaFDq4 JJydU2KhRLL0VAzT6gVC/w==; Original-Received: from [87.69.77.57] (port=2584 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nfggJ-0000cs-V8; Sat, 16 Apr 2022 07:33:36 -0400 In-Reply-To: <878rs55m81.fsf@gmail.com> (message from Tino Calancha on Sat, 16 Apr 2022 12:58:06 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229976 Archived-At: > From: Tino Calancha > Cc: 54804@debbugs.gnu.org, uyennhi.qm@gmail.com > Date: Sat, 16 Apr 2022 12:58:06 +0200 > > Eli Zaretskii writes: > > > but why does the implementation have to be so complicated? > > Isn't this just about turning off case-fold-search while searching for > > the character? What am I missing? > > The patch is moving the shared code in zap-to/zap-up-to in a > helper function. This has 2 motivations: > - reduce the code duplication. > - define these two related functions close each other. > - separate the logic of the function to calculate the region to kill. > > If you prefer, we can keep the functions in their current > locations (simple.el/misc.el) with a patch like this one: What I'd prefer is to have a single function (in subr.el) that determines whether a character is an upper- or lower-case, and then use that function in a simple condition in these two commands. The function to check whether a character is upper-case doesn't have to make a string from the character and then use the "heavy artillery" of string-match-p, it could instead use something like (characterp (get-char-code-property CHAR 'uppercase)) (But beware of the situation where the Unicode tables are not yet available during bootstrap -- in those cases the function should IMO punt and return nil no matter what the character is, or maybe support just the ASCII characters. To test whether the 'uppercase table is available, see if unicode-property-table-internal returns non-nil.) > + ;; Avoid "obsolete" warnings for translation-table-for-input. > + (with-no-warnings > + (if (char-table-p translation-table-for-input) > + (setq char (or (aref translation-table-for-input char) char)))) translation-table-for-input is obsolete for a reason, so adding it to a new function is not something we want to do. If anything, we should remove it from the old function.