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#65347: 29.1; Underscore in query replace prevents case-matching Date: Fri, 18 Aug 2023 21:15:21 +0300 Message-ID: <83wmxs2p52.fsf@gnu.org> References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24584"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 18 20:16:24 2023 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 1qX41H-00067g-KS for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Aug 2023 20:16:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX40y-0005zH-0t; Fri, 18 Aug 2023 14:16:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qX40w-0005z9-5d for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 14:16:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX40v-0008N0-U1 for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 14:16:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qX40w-00039j-Df for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 14:16: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: Fri, 18 Aug 2023 18:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65347 X-GNU-PR-Package: emacs Original-Received: via spool by 65347-submit@debbugs.gnu.org id=B65347.169238252312086 (code B ref 65347); Fri, 18 Aug 2023 18:16:02 +0000 Original-Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 18:15:23 +0000 Original-Received: from localhost ([127.0.0.1]:48703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX40J-00038s-0O for submit@debbugs.gnu.org; Fri, 18 Aug 2023 14:15:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX40E-00038a-CX for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 14:15:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qX407-0008C3-93; Fri, 18 Aug 2023 14:15:11 -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=eoRR92O7uVAenGAeUyXjTvmF1CY7S0XEOMX5i+eIOpk=; b=o9HU10StWG3J Ue38iatBDmfbWPDr4pU6Cj+es73XJ56YlEgmkKLXXadV6yycr1RFRwB+590utTM47tbyog6kZW500 b/ybWk71bfQ75c/d8vbPceRMgZa3W8rT6bJZFSAauvbl0GIphHsyDqioIkMGm1291++wvAmxTBvL6 SJ6RxDwD60DFUXEESWA6v+n4dsdt3Zd3NPDWqNpHlOJg+nQ11QHewlPuQ3e28sjfi7xu8RovdYp0K tNkmDBKWfgjly92WlcWJwTLV5jyro9ntEjSL7iCVzeIFifE9sxcXk01SOK8NjP3flXqVdEnYzXmo8 0qlaZBC4RGjBKoQgzh5pOQ==; In-Reply-To: (message from Spencer Baugh on Fri, 18 Aug 2023 12:30:48 -0400) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267777 Archived-At: > From: Spencer Baugh > Cc: Stefan Monnier , 65347@debbugs.gnu.org > Date: Fri, 18 Aug 2023 12:30:48 -0400 > > Eli Zaretskii writes: > >> There's `superword-mode`, but I suspect that query-replace does not > >> honor it in this case. Could be considered as a bug in > >> `superword-mode`. > > > > Actually, I think it's a bug in replace-match: it doesn't honor > > find-word-boundary-function-table. I think it should. Patches > > welcome. > > I suppose this is a bit of an XY problem - the real thing I (speaking > for the user who reported this to me) want is to have case-matching for > symbols instead of words. We look at this from different angles. As an Emacs maintainer, I would like to see every place that deals with words to honor find-word-boundary-function-table, instead of inventing its own ideas about where a word begins and where it ends. > e.g. if I have Foo-do-action and I do a replace of foo-do-action with > bar-do-action, I want the replacement to be Bar-do-action. Here, you look at the issue from a very narrow perspective: of words separated by '-' or '_', because that just happens to be the case that you bumped into. But that is just one very particular use case; words can be separated by a lot more characters. I would actually begin considering the simpler case of "Foo do action". > Alternatively, much more simply, maybe the case-matching could just > detect if the first word is capitalized, and then also capitalize the > first word in the replacement? That would work for this specific usage. Given enough user options, we could support that as optional behavior. But one thing is clear: we cannot simultaneously support all of the possible interpretations of "capitalization pattern". And another thing is clear: this heuristic is confusing and rarely kept in mind as it is, so imagine what will happen if we add half a dozen options to support its variants...