From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 16 17:27:47 2023 Received: (at submit) by debbugs.gnu.org; 16 Aug 2023 21:27:47 +0000 Received: from localhost ([127.0.0.1]:42269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWO3O-0003KK-KQ for submit@debbugs.gnu.org; Wed, 16 Aug 2023 17:27:47 -0400 Received: from lists.gnu.org ([2001:470:142::17]:50678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWO3M-0003K7-VS for submit@debbugs.gnu.org; Wed, 16 Aug 2023 17:27:45 -0400 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 1qWO3H-0002Mr-3E for bug-gnu-emacs@gnu.org; Wed, 16 Aug 2023 17:27:39 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWO3E-0003z0-QO for bug-gnu-emacs@gnu.org; Wed, 16 Aug 2023 17:27:38 -0400 From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: 29.1; Underscore in query replace prevents case-matching Date: Wed, 16 Aug 2023 17:27:34 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) 1. emacs -Q 2. (insert "Foo_bar") 3. M-% foo RET quux RET 4. Observe the buffer contains Quux_bar 5. Undo, so the buffer contains Foo_bar again 6. M-% foo_bar RET quux RET 7. Observe the buffer contains quux Expected behavior: 7. Observe the buffer contains Quux It seems to me that this would match the docstring better: Replacement transfers the case pattern of the old text to the new text, if both =E2=80=98case-fold-search=E2=80=99 and =E2=80=98case-re= place=E2=80=99 are non-nil and FROM-STRING has no uppercase letters. In GNU Emacs 29.1 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2023-08-08 built on Repository revision: ea63217c1c85f1ca4f1f22b9c4781167de6cf00d Repository branch: my-emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.8 (Green Obsidian) Configured using: 'configure --config-cache --with-x-toolkit=3Dlucid --with-gif=3Difavailable' Configured features: CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 64542 9889) (symbols 48 9474 0) (strings 32 23737 1993) (string-bytes 1 692637) (vectors 16 9301) (vector-slots 8 148671 13049) (floats 8 34 25) (intervals 56 241 0) (buffers 976 10)) From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 17 03:14:37 2023 Received: (at 65347) by debbugs.gnu.org; 17 Aug 2023 07:14:37 +0000 Received: from localhost ([127.0.0.1]:42672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWXDJ-0004ze-9V for submit@debbugs.gnu.org; Thu, 17 Aug 2023 03:14:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWXDH-0004zQ-5N for 65347@debbugs.gnu.org; Thu, 17 Aug 2023 03:14:36 -0400 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 1qWXDB-0001T7-NC; Thu, 17 Aug 2023 03:14:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=KmSKoSoLrWw2wdkfzLVuoV3z9O3sGWWWPQuGscGSYY4=; b=hpNG5jJ7T3ZhR/x+jXey 6Y8FfNWbM6sQW2ZxjWUkbelcCMFRHoMC0miaNjiICjlb4MFRCV8xyZnh9pHgcvcVRVUNtehDN4p4k Lkvs/I3fklPi+u2k8PIhwD6dVLLt4qRfqpAANZ8sJTOmb0t5z0hRCA1OSEyci0bG+a4FPdEEa68SA 6jfcXV/L3JKSK0fv06r0zK92gLSIlmYE9QD+oIsUIVnKEdffRyPcTvuW1KnHeGltnnxWKXMfcO78D QyspvtD3QyLWJdN2k1oPUIGXF/11zMQPCr/mC8gt9wZaqM421DtD9WCrj7d+2TY0uW1RtZHL9oihK D9r8vzCM4+2FLg==; Date: Thu, 17 Aug 2023 10:14:36 +0300 Message-Id: <838raa6syr.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Wed, 16 Aug 2023 17:27:34 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Date: Wed, 16 Aug 2023 17:27:34 -0400 > > > 1. emacs -Q > 2. (insert "Foo_bar") > 3. M-% foo RET quux RET > 4. Observe the buffer contains Quux_bar > 5. Undo, so the buffer contains Foo_bar again > 6. M-% foo_bar RET quux RET > 7. Observe the buffer contains quux > > Expected behavior: > 7. Observe the buffer contains Quux > > It seems to me that this would match the docstring better: > > Replacement transfers the case pattern of the old text to the > new text, if both ‘case-fold-search’ and ‘case-replace’ are > non-nil and FROM-STRING has no uppercase letters. This is a documentation issue: the complex heuristics used by replace-match to decide whether and how to "transfer the case pattern" depend on whether _all_ the words in the replaced text use the same case pattern. In your example, Foo_bar is 2 words (what is a "word" is determined by the buffer's syntax table), and only one of them is capitalized. So Emacs does not capitalize the replacement. Try doing the same with Foo_Bar, and you will see Quux in the replacement. These subtleties come up from time to time, so I think it's high time we documented that (in the hope this will stop this from popping up), so I've now done so on the emacs-29 branch. I think this is all we should do here, as the behavior is correct and justified, has been like that since time immemoriam, and we should not change it, therefore. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 17 08:42:44 2023 Received: (at 65347) by debbugs.gnu.org; 17 Aug 2023 12:42:44 +0000 Received: from localhost ([127.0.0.1]:42926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWcKp-0001v0-Ku for submit@debbugs.gnu.org; Thu, 17 Aug 2023 08:42:44 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:57467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWcKn-0001um-7P for 65347@debbugs.gnu.org; Thu, 17 Aug 2023 08:42:42 -0400 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <838raa6syr.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 17 Aug 2023 10:14:36 +0300") References: <838raa6syr.fsf@gnu.org> Date: Thu, 17 Aug 2023 08:42:35 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Spencer Baugh >> Date: Wed, 16 Aug 2023 17:27:34 -0400 >>=20 >>=20 >> 1. emacs -Q >> 2. (insert "Foo_bar") >> 3. M-% foo RET quux RET >> 4. Observe the buffer contains Quux_bar >> 5. Undo, so the buffer contains Foo_bar again >> 6. M-% foo_bar RET quux RET >> 7. Observe the buffer contains quux >>=20 >> Expected behavior: >> 7. Observe the buffer contains Quux >>=20 >> It seems to me that this would match the docstring better: >>=20 >> Replacement transfers the case pattern of the old text to the >> new text, if both =E2=80=98case-fold-search=E2=80=99 and =E2=80=98case= -replace=E2=80=99 are >> non-nil and FROM-STRING has no uppercase letters. > > This is a documentation issue: the complex heuristics used by > replace-match to decide whether and how to "transfer the case pattern" > depend on whether _all_ the words in the replaced text use the same > case pattern. In your example, Foo_bar is 2 words (what is a "word" > is determined by the buffer's syntax table), and only one of them is > capitalized. So Emacs does not capitalize the replacement. Try doing > the same with Foo_Bar, and you will see Quux in the replacement. > > These subtleties come up from time to time, so I think it's high time > we documented that (in the hope this will stop this from popping up), > so I've now done so on the emacs-29 branch. > > I think this is all we should do here, as the behavior is correct and > justified, has been like that since time immemoriam, and we should not > change it, therefore. Ah, that makes sense! I have no further complaint then and we should be able to close the bug. Although, a further relevant question: is there some way to make _ not be a word separator, in this specific context? Without changing the syntax table of the buffer overall? So that foo_bar is interpreted as one word? Maybe some kind of escaping? From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 17 09:26:46 2023 Received: (at 65347-done) by debbugs.gnu.org; 17 Aug 2023 13:26:46 +0000 Received: from localhost ([127.0.0.1]:42959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWd1R-00031T-Sz for submit@debbugs.gnu.org; Thu, 17 Aug 2023 09:26:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWd1M-000318-Km for 65347-done@debbugs.gnu.org; Thu, 17 Aug 2023 09:26:43 -0400 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 1qWd19-0003y0-TY; Thu, 17 Aug 2023 09:26:33 -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=XrDkzpBQOzAdzkjm1ZlIHW39vPOJtnOMtOGdEA7WZmM=; b=jYgqIrklfjNC +KRYU+kT/ufMqrDI9XpfbP1ftDgZmhplJOGmcYYfr/MNK11xAcQ0Cd+LnjzRJ8mJEh2hCXGHUWTKA hY7cnuB+Rxusi6Iz766y22F0luM7ADJC/xOyj/BO0dGURJ4BR+TRTU2TJC4dzNNhgaiNGffbRycgc w4PGjJIKk8s+Ib1A8Mw0xUMVL9MGb++q0l37saIaQML1pVKQZXysazKbLPmwaUaETWf0sRgDYT8JX 9x1+ojOjedJMT+9RZPV8V50WCM3JTGtKCFbSeJxvISRhu084W2oXNAZiPIWkwxrP2LinNAJqHc95Z voq0RK//4lj1EjtX3m0IzQ==; Date: Thu, 17 Aug 2023 16:26:35 +0300 Message-Id: <83il9d6bqs.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh , Stefan Monnier In-Reply-To: (message from Spencer Baugh on Thu, 17 Aug 2023 08:42:35 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347-done Cc: 65347-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 65347@debbugs.gnu.org > Date: Thu, 17 Aug 2023 08:42:35 -0400 > > Eli Zaretskii writes: > > > These subtleties come up from time to time, so I think it's high time > > we documented that (in the hope this will stop this from popping up), > > so I've now done so on the emacs-29 branch. > > > > I think this is all we should do here, as the behavior is correct and > > justified, has been like that since time immemoriam, and we should not > > change it, therefore. > > Ah, that makes sense! I have no further complaint then and we should be > able to close the bug. Done now. > Although, a further relevant question: is there some way to make _ not > be a word separator, in this specific context? Without changing the > syntax table of the buffer overall? So that foo_bar is interpreted as > one word? > > Maybe some kind of escaping? I'm not aware of any such way. The code explicitly checks the syntax to be 'word' or not 'word'. But maybe Stefan has some insights? You could, of course, make a wrapper command that would modify the syntax table before invoking the real thing. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 17 22:05:08 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 02:05:08 +0000 Received: from localhost ([127.0.0.1]:45803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWorM-0007Lw-2I for submit@debbugs.gnu.org; Thu, 17 Aug 2023 22:05:08 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11779) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWorG-0007LF-GF for 65347@debbugs.gnu.org; Thu, 17 Aug 2023 22:05:06 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B3F294452A8; Thu, 17 Aug 2023 22:04:56 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692324295; bh=1GAFdDKRmOlNAwYv51KCdBOn1FOyLmhWcdeWa8awDQg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=cnI+0NeoQPaUSEl+5idVzAGx/jFH6Ip+mGEsCAWU8YjQ7Cx9zbEU8VsNJOLtZ5YG4 RcTCEjOGCS0T/5nvVY0j4aZdnjAix+rQXZE7xJ8diZbMGV3ltPyDxhZYBec7uAnqD7 0K8qTzgN7ZRBX8CR3dWmiLViCBOjQwpjxcXf7levT7P76WtpN0YwYkzhTCUGymFUuS fPJwMMe4foOTIOwkIqu6SCQuOetTUpshlsyus8ZYZLu/MwSXFuj5kYqDbGuPA1i2uq 5Dy1qkcDS9+Kdm0JfIXuMJ9R0Y9SlVnzNM9yCwAlytO3JCjpAJaUvbyZgL3lGkYevA nrb6sF6LhvGyw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6E7E14452A7; Thu, 17 Aug 2023 22:04:55 -0400 (EDT) Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4339312020D; Thu, 17 Aug 2023 22:04:55 -0400 (EDT) From: Stefan Monnier To: Spencer Baugh Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: (Spencer Baugh's message of "Thu, 17 Aug 2023 08:42:35 -0400") Message-ID: References: <838raa6syr.fsf@gnu.org> Date: Thu, 17 Aug 2023 22:04:53 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.022 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: Eli Zaretskii , 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Although, a further relevant question: is there some way to make _ not > be a word separator, in this specific context? Without changing the > syntax table of the buffer overall? So that foo_bar is interpreted as > one word? 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`. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 02:05:00 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 06:05:00 +0000 Received: from localhost ([127.0.0.1]:45940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWsbU-0008Df-3w for submit@debbugs.gnu.org; Fri, 18 Aug 2023 02:05:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWsbS-0008DN-G2 for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 02:04:59 -0400 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 1qWsbL-0002Ax-Ng; Fri, 18 Aug 2023 02:04:51 -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=T2Mtx6o/gRBJxmgp6J7NjcBkAbYL8FteIW7lmTov9VY=; b=hGfTuuptIgm7 +rS0wntPaSxFz8s7vQ62rz8OWDj2DLxjNdZBCQGadR1UKkDsCU3KP4ISb5UQ9gd52+GvEy/QW5r1S A3w4bq7PlNOJeGx9uDKEL5qg69wmkT2pZwxgSD8rDOy2h7rm+63jdWCaCSRXFe0tQzr0fNhnlDvw9 y6pC4C5qREELSr/E3PFPIyLEYs8ivu6dCHIVY65t27bnSr4sTQE3V6r4T346hek9Iq1dBaqVcCLow oM0eu+gJ3diHpU2WpWFYHlBPjaw0JA17+XDegG5aRAEE9mDgv/T0NgBuKb/GuKPQFV8MrbFWJhLAY 42/Fjk/lJQ4GB+Qiq0GJCQ==; Date: Fri, 18 Aug 2023 09:04:57 +0300 Message-Id: <83o7j451iu.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Thu, 17 Aug 2023 22:04:53 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Eli Zaretskii , 65347@debbugs.gnu.org > Date: Thu, 17 Aug 2023 22:04:53 -0400 > > > Although, a further relevant question: is there some way to make _ not > > be a word separator, in this specific context? Without changing the > > syntax table of the buffer overall? So that foo_bar is interpreted as > > one word? > > 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. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 12:30:58 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 16:30:58 +0000 Received: from localhost ([127.0.0.1]:48595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX2NG-0000FG-HT for submit@debbugs.gnu.org; Fri, 18 Aug 2023 12:30:58 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:56097) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX2ND-0000Ey-8E for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 12:30:56 -0400 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <83o7j451iu.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 18 Aug 2023 09:04:57 +0300") References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> Date: Fri, 18 Aug 2023 12:30:48 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Stefan Monnier >> Cc: Eli Zaretskii , 65347@debbugs.gnu.org >> Date: Thu, 17 Aug 2023 22:04:53 -0400 >> >> > Although, a further relevant question: is there some way to make _ not >> > be a word separator, in this specific context? Without changing the >> > syntax table of the buffer overall? So that foo_bar is interpreted as >> > one word? >> >> 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. 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. That seems like a reasonable customization... I could add support for this to replace-match - it would just be a matter of teaching it to conditionally use symbol boundaries instead of word boundaries. Alternatively, much more interestingly, the case-matching could *always* detect case patterns both for symbols and for words. And if there's no case pattern for words, but there is a case pattern for symbols, apply that case pattern to symbols in the replacement. We could even turn that on by default. Does that sound like a good change? I can make that change if it sounds desirable. 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. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 14:15:23 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 18:15:23 +0000 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 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 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==; Date: Fri, 18 Aug 2023 21:15:21 +0300 Message-Id: <83wmxs2p52.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Fri, 18 Aug 2023 12:30:48 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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... From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 14:31:54 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 18:31:54 +0000 Received: from localhost ([127.0.0.1]:48776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX4GH-0003ay-Ii for submit@debbugs.gnu.org; Fri, 18 Aug 2023 14:31:53 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:50027) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX4GG-0003an-8X for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 14:31:52 -0400 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <83wmxs2p52.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 18 Aug 2023 21:15:21 +0300") References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> Date: Fri, 18 Aug 2023 14:31:46 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> 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. Understandable, I want this too of course. Better support for case matching in words would be good. >> 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". But no, this use case very specifically is about replacing symbols (sexps) while matching case. There's a body of code which frequently uses the same symbol with different capitalization (both as a lowercase variable name and an uppercase type name) and I want to do replacements which match case. I don't much care about the word boundary or superword-mode, because I'm not dealing with words - I'm very deliberately dealing with symbols. >> 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... Sure. This idea is very hacky anyway. What about the other thing I proposed? That's what I'm more interested in, because this is a problem of replacing symbols. And it's much more elegant. Repeated here: >>Alternatively, much more interestingly, the case-matching could *always* >>detect case patterns both for symbols and for words. And if there's no >>case pattern for words, but there is a case pattern for symbols, apply >>that case pattern to symbols in the replacement. We could even turn >>that on by default. Does that sound like a good change? I can make >>that change if it sounds desirable. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 15:06:31 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 19:06:31 +0000 Received: from localhost ([127.0.0.1]:48808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX4nn-0004Ua-3y for submit@debbugs.gnu.org; Fri, 18 Aug 2023 15:06:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX4nl-0004UN-DC for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 15:06:29 -0400 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 1qX4ne-0005nr-Ev; Fri, 18 Aug 2023 15:06:22 -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=jkqWJRS1IBxqyTnIw3OUwtCMVnc2cCbzvdxGSumPt2E=; b=OCD5YQapkk+o BQQZe4v6dzal+qBJDT5dsK62lbMb5BrHS5CnazXsBpZXBjrUCgS+xDkgXFKm81oH+nZ3sXYBCriJo PQt2QKt+ZBPt69SqkJWhNPhOcRtUnDa0oIXuFLKiSuU5fZi6QkYkayigzK5Zngd/0o+HeAFyR55ns Da1m+kVHojj4Ft+dH9X5eftWvBPyFoIgioXYKQ3PQVTzrCycZP+okHRrwWoVLcpWlaDJxwT6QTYVT VejNCkSWiucGuis4/WkVNrz37Ml2FZW5AWHn6MKPBtOuo8k6HUren/TMBJnOHI3ckC3dGFkjysHAm oHfdch4/7wls8/wPNe0Wkg==; Date: Fri, 18 Aug 2023 22:06:32 +0300 Message-Id: <83sf8g2mrr.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Fri, 18 Aug 2023 14:31:46 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca > Date: Fri, 18 Aug 2023 14:31:46 -0400 > > > 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". > > But no, this use case very specifically is about replacing symbols > (sexps) while matching case. What are "symbols" in this context? > I don't much care about the word boundary or superword-mode, because I'm > not dealing with words - I'm very deliberately dealing with symbols. Capitalization issues with program code are conceptually different from those with human-readable text. You are basically talking about refactoring, not about text replacement. So the use cases that are of interest to you are not well supported by query-replace, because it doesn't target them. It could well mean that you will need a custom replace-match function. Insisting on replace-match to support these cases is not necessarily wise, from where I stand. > What about the other thing I proposed? That's what I'm more interested > in, because this is a problem of replacing symbols. And it's much more > elegant. Repeated here: > > >>Alternatively, much more interestingly, the case-matching could *always* > >>detect case patterns both for symbols and for words. And if there's no > >>case pattern for words, but there is a case pattern for symbols, apply > >>that case pattern to symbols in the replacement. We could even turn > >>that on by default. Does that sound like a good change? I can make > >>that change if it sounds desirable. I don't understand the proposal. Again, what are "symbols" in this context, and how are they different from "words"? From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 15:14:55 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 19:14:55 +0000 Received: from localhost ([127.0.0.1]:48826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX4vu-0004iO-VG for submit@debbugs.gnu.org; Fri, 18 Aug 2023 15:14:55 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:45597) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX4vs-0004iB-D6 for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 15:14:53 -0400 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <83sf8g2mrr.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 18 Aug 2023 22:06:32 +0300") References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83sf8g2mrr.fsf@gnu.org> Date: Fri, 18 Aug 2023 15:14:46 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca >> Date: Fri, 18 Aug 2023 14:31:46 -0400 >> >> > 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". >> >> But no, this use case very specifically is about replacing symbols >> (sexps) while matching case. > > What are "symbols" in this context? Strings made up of symbol constituents as defined by the current major-mode's syntax table. The normal definition of symbols. >> I don't much care about the word boundary or superword-mode, because I'm >> not dealing with words - I'm very deliberately dealing with symbols. > > Capitalization issues with program code are conceptually different > from those with human-readable text. You are basically talking about > refactoring, not about text replacement. So the use cases that are of > interest to you are not well supported by query-replace, because it > doesn't target them. It could well mean that you will need a custom > replace-match function. Insisting on replace-match to support these > cases is not necessarily wise, from where I stand. Hm, that's fair. Although I would bet that the majority of usage of query-replace is with program code, since the majority of Emacs usage is with program code. So features which make query-replace work better with code are still useful. Another feature that could support this would be to allow defining multiple query/replacement pairs, and applying them together across the file or across multiple files, querying as we go. Then "foo" could be replaced with "bar" and "Foo" with "Bar". That kind of simultaneous replacement is something I've definitely wanted before. >> What about the other thing I proposed? That's what I'm more interested >> in, because this is a problem of replacing symbols. And it's much more >> elegant. Repeated here: >> >> >>Alternatively, much more interestingly, the case-matching could *always* >> >>detect case patterns both for symbols and for words. And if there's no >> >>case pattern for words, but there is a case pattern for symbols, apply >> >>that case pattern to symbols in the replacement. We could even turn >> >>that on by default. Does that sound like a good change? I can make >> >>that change if it sounds desirable. > > I don't understand the proposal. Again, what are "symbols" in this > context, and how are they different from "words"? The normal definition of symbols in Emacs, as defined by the syntax table. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 15:20:33 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 19:20:33 +0000 Received: from localhost ([127.0.0.1]:48837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX51N-0004sG-JF for submit@debbugs.gnu.org; Fri, 18 Aug 2023 15:20:33 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX51K-0004s2-22 for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 15:20:31 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 099C1442A68; Fri, 18 Aug 2023 15:20:24 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692386422; bh=y07BINQeRawJ5tJNlo6CQtYld296IbLJBsxGa0Zut8w=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=FAA31yy84tbz8UC3YuIVUkWft3oxE5pC4ACOsOVsqOJA9ZyVvgJYHMHx0y2Hgj95n L2o+p4+CqjrLm3Aa9X+xHy1ScsDeypE8RxjGsPJZ1Bz70NOfG9ivAPFr9XIZYQLBh2 Z1r0tY5JeIUqwH8VLSD20k0a2IOV6uPC0BQy7B3T8ztlyFQke5FWgwp/KcYeBymw2b E/MfqD51B4C9JXId9NKuIl7G7+Y0XxIh2DWpIu1tQXnRr7diqmz1+D+of7oqp2JeHD uyyifJZ63D3gtMYGPoL+E3uJvUhT7WCs8xEQNObqrOSj3v4iktCwr2VckrzWTVOXnW jGZ84ZVE0e9QA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 86395440409; Fri, 18 Aug 2023 15:20:22 -0400 (EDT) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 645BF12023C; Fri, 18 Aug 2023 15:20:22 -0400 (EDT) From: Stefan Monnier To: Spencer Baugh Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: (Spencer Baugh's message of "Fri, 18 Aug 2023 14:31:46 -0400") Message-ID: References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> Date: Fri, 18 Aug 2023 15:20:21 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.034 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: Eli Zaretskii , 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> 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. Yes, that could be good in any case. It would happen to fix the example problem, tho only in the specific case where the user has enabled `superword-mode`. In my experience, there are enough slightly different circumstances that it's going to be hard to cover all cases automatically. Personally (as a user) the functionality I'd prefer is the following: When the matched string does not have the same capitalization as the search pattern, I'd like Emacs to guess what should be the capitalization of the replacement and ask me to confirm its guess. This solution would not satisfy the "automatically" part, but it would succeed at the "cover all cases" part, only at the small cost of an extra RET. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 15:29:04 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 19:29:04 +0000 Received: from localhost ([127.0.0.1]:48843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX59b-000560-IJ for submit@debbugs.gnu.org; Fri, 18 Aug 2023 15:29:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX59Z-00055U-Iq for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 15:29:02 -0400 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 1qX59S-0001vZ-VA; Fri, 18 Aug 2023 15:28:54 -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=/EyrjfAXHsHAFe1lJpnrooL5FB4nCfZARqhZ3JXST6g=; b=SUwcG+3qJVUE HFhfqdgSh390vlT0TLB756u6iaKi9umVefVlDfGM4m7p8oU4GR/3kkgVIp6nF+ZzB9ZG3/24GLI3H Sy0dt89Iy5nz4A4iugBK74QvE/hgUPAVpRfOzEug8rO1YFKFKFZgsXNlYU0w3MjTRCwR28A70seBL jLONDLnvsvLst1DNgJS8nfXw0Nws9JmQs4GfHLHpFmKCNP17PfEz0dUYO5KU+cLYGXX9Crv2SjmEv Azr5zemP37Oksca00IJzIsMuV3ooSaogtgitPSYsqB6iYaZ3y1HygrIsoDKpnUtgkcTxIDsdVCpmA 0BbhGllY8CN69awgRnXRqg==; Date: Fri, 18 Aug 2023 22:29:04 +0300 Message-Id: <83o7j42lq7.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Fri, 18 Aug 2023 15:14:46 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83sf8g2mrr.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca > Date: Fri, 18 Aug 2023 15:14:46 -0400 > > > What are "symbols" in this context? > > Strings made up of symbol constituents as defined by the current > major-mode's syntax table. The normal definition of symbols. Then you are talking about something very different from "words". > > Capitalization issues with program code are conceptually different > > from those with human-readable text. You are basically talking about > > refactoring, not about text replacement. So the use cases that are of > > interest to you are not well supported by query-replace, because it > > doesn't target them. It could well mean that you will need a custom > > replace-match function. Insisting on replace-match to support these > > cases is not necessarily wise, from where I stand. > > Hm, that's fair. Although I would bet that the majority of usage of > query-replace is with program code, since the majority of Emacs usage is > with program code. That's profoundly not true! Emacs is used with human-readable text not less, and maybe more, than with program source code. I'm typing this email in Emacs; I'm routinely making changes to our documentation in Emacs -- these and others are all frequent text-editing activities. > So features which make query-replace work better with code are still > useful. No, we need a real refactoring in Emacs! Using M-% as poor-man's refactoring is fine, but pretending that it _is_ refactoring, and adding minor extensions to it that are motivated by refactoring, is simply wrong! It will likely complicate the text-oriented replacement we have already, and will always fall short of decent refactoring capabilities. We should work on adding refactoring instead of tweaking M-% and M-* in these directions. > Another feature that could support this would be to allow defining > multiple query/replacement pairs, and applying them together across the > file or across multiple files, querying as we go. Then "foo" could be > replaced with "bar" and "Foo" with "Bar". That kind of simultaneous > replacement is something I've definitely wanted before. IMO, this makes little or no sense in human-readable text; it does make sense in the refactoring context. So let's add refactoring capabilities to Emacs, and leave M-% for text. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 18 17:00:22 2023 Received: (at 65347) by debbugs.gnu.org; 18 Aug 2023 21:00:22 +0000 Received: from localhost ([127.0.0.1]:48914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX6Zy-0007eN-9Q for submit@debbugs.gnu.org; Fri, 18 Aug 2023 17:00:22 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:34273) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qX6Zv-0007eA-Rq for 65347@debbugs.gnu.org; Fri, 18 Aug 2023 17:00:20 -0400 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <83o7j42lq7.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 18 Aug 2023 22:29:04 +0300") References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83sf8g2mrr.fsf@gnu.org> <83o7j42lq7.fsf@gnu.org> Date: Fri, 18 Aug 2023 17:00:12 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca >> Date: Fri, 18 Aug 2023 15:14:46 -0400 >> >> > What are "symbols" in this context? >> >> Strings made up of symbol constituents as defined by the current >> major-mode's syntax table. The normal definition of symbols. > > Then you are talking about something very different from "words". > >> > Capitalization issues with program code are conceptually different >> > from those with human-readable text. You are basically talking about >> > refactoring, not about text replacement. So the use cases that are of >> > interest to you are not well supported by query-replace, because it >> > doesn't target them. It could well mean that you will need a custom >> > replace-match function. Insisting on replace-match to support these >> > cases is not necessarily wise, from where I stand. >> >> Hm, that's fair. Although I would bet that the majority of usage of >> query-replace is with program code, since the majority of Emacs usage is >> with program code. > > That's profoundly not true! Emacs is used with human-readable text > not less, and maybe more, than with program source code. I'm typing > this email in Emacs; I'm routinely making changes to our documentation > in Emacs -- these and others are all frequent text-editing activities. > >> So features which make query-replace work better with code are still >> useful. > > No, we need a real refactoring in Emacs! Using M-% as poor-man's > refactoring is fine, but pretending that it _is_ refactoring, and > adding minor extensions to it that are motivated by refactoring, is > simply wrong! It will likely complicate the text-oriented replacement > we have already, and will always fall short of decent refactoring > capabilities. > > We should work on adding refactoring instead of tweaking M-% and M-* > in these directions. Okay, I'm convinced. I'll defer this functionality to the future refactoring support in Emacs, built with project.el and eglot no doubt. >> Another feature that could support this would be to allow defining >> multiple query/replacement pairs, and applying them together across the >> file or across multiple files, querying as we go. Then "foo" could be >> replaced with "bar" and "Foo" with "Bar". That kind of simultaneous >> replacement is something I've definitely wanted before. > > IMO, this makes little or no sense in human-readable text; it does > make sense in the refactoring context. So let's add refactoring > capabilities to Emacs, and leave M-% for text. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 01:50:03 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 05:50:03 +0000 Received: from localhost ([127.0.0.1]:49232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXEqZ-0000YJ-0q for submit@debbugs.gnu.org; Sat, 19 Aug 2023 01:50:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33726) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXEqW-0000Xl-Pj for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 01:50:01 -0400 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 1qXEqO-0001kn-SD; Sat, 19 Aug 2023 01:49:52 -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=XKIhjK8JwPM/VFelyq+XB3P/FBdT0sgFMgZPO5gvEfE=; b=o7xXbJp3LAXD BLE+O/+1DTRbfWQlEWaWpJsJVAkmLZcAYdjRzcbd0k8q/MyxLPW95zR6cttHf5hPgkukGAn5WxwvI qwgeaVBJdNKXvhvfRrkh+QxlJMENtekLQVz7DsJ1I3nsAgrJEl1bXJ1hbbQ1eU0yebKGAzCRPxPGG sp+a+PceftoZT58X98e3Br8+lH67uvaUZhm1jDkUD+/j3Pa13MbYCM8RqsB2DwZ8oaOGhb5atKkx8 UXEVRI0rtFzD6Q3EXOaxSpusCGhFyrWCryuVcCoQSIhQgO5oWWQhRUSB62uwZOz38klVMmifV1oFf z4vtbyzm7y4A2emp84sZjg==; Date: Sat, 19 Aug 2023 08:50:04 +0300 Message-Id: <83msyn37jn.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Fri, 18 Aug 2023 15:20:21 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Eli Zaretskii , 65347@debbugs.gnu.org > Date: Fri, 18 Aug 2023 15:20:21 -0400 > > In my experience, there are enough slightly different circumstances that > it's going to be hard to cover all cases automatically. Perhaps, but this could only be established by auditing each case one by one. > Personally (as a user) the functionality I'd prefer is the following: > When the matched string does not have the same capitalization as the search > pattern, I'd like Emacs to guess what should be the capitalization of > the replacement and ask me to confirm its guess. This already happens? M-% shows you the replacement in the exact capitalization it will insert, _after_ the guesswork. And you are already requested to confirm each replacement. So what is missing? From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 02:00:34 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 06:00:34 +0000 Received: from localhost ([127.0.0.1]:49244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXF0j-0000r1-QH for submit@debbugs.gnu.org; Sat, 19 Aug 2023 02:00:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXF0i-0000qi-GW for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 02:00:33 -0400 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 1qXF0b-00045e-KU; Sat, 19 Aug 2023 02:00:25 -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=HbUkDymg+1nlf9c4ih/4nGN1dpi5f/NuB7omLfEp/+o=; b=OHGMxHxAK6qY KPE+LULAPvUnPlDlbWGpufmWvIdhgW7sJUbYriZYOVFITgHgBQvUFaOGJ8rxf8HNlVuzVWfHWlpj8 LZh83rPJAsllrfjztnbBrUKUk7THHZFMMuVRwTxbiQ0AaZU2ZPTYwimtiIHM1wbsRRp6JYS6Fvnsg d4UNRcetVMvPkiyHxuo81HUD7PCT37+520RfOhLdevtmHcRWf5rwu0NDNpdOoGOH0SnQfs6WbOPKM i5yqAiOKr/lWUk/msAhIscpdGq3Hw2WBEotQWxpGYjBtdOAdUAfn4c1iPCeiVKCO1VwnkEYvfUxXw 7rYgq23m6scjAGif8SEHPw==; Date: Sat, 19 Aug 2023 09:00:37 +0300 Message-Id: <83h6ov3722.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Fri, 18 Aug 2023 17:00:12 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83sf8g2mrr.fsf@gnu.org> <83o7j42lq7.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 65347@debbugs.gnu.org, monnier@iro.umontreal.ca > Date: Fri, 18 Aug 2023 17:00:12 -0400 > > > We should work on adding refactoring instead of tweaking M-% and M-* > > in these directions. > > Okay, I'm convinced. I'll defer this functionality to the future > refactoring support in Emacs, built with project.el and eglot no doubt. Eglot can serve as the back-end, and it isn't the only one that comes to mind (I sincerely hope that at least some of the simpler refactoring jobs will not require an LSP, but could be done using built-in capabilities). But back-end is just one part of this. We should IMO begin by our own research into the UI parts of this: how does the user specify the requested refactoring? Several alternatives are possible, and we should study them and decide what is best for Emacs. Would someone please step forward and work on adding refactoring to Emacs? From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 10:39:21 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 14:39:21 +0000 Received: from localhost ([127.0.0.1]:52097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXN6m-0000yK-S4 for submit@debbugs.gnu.org; Sat, 19 Aug 2023 10:39:21 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXN6j-0000y7-SW for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 10:39:19 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 13ED61000BD; Sat, 19 Aug 2023 10:39:11 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692455950; bh=rNcKQC78H/8iORKH0RbVVNvq5Hlu6tIUph790xrqya4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fFxY3A9ekWfJXgwHQP52FQ155X1HRwpF+qO4HcWeDB4IZVmzcDtvSvZdOMasFpX/O v4ycJe878ORzpAQLaA6GmHEnBBGnTfZNl/15A0N4v9uSeHeU1P16f+7Y8i6iXhbOBa m6+/4jl2Xtp+Gn+LmtA6RfEY+g0uGa1GV2T/d7Apa5sqhyuxPaCFgq0OpN/J31dk2F PH9oIvyN7zrECH1iU0wbY6XqEZE7yS7q4MRHgD71apLY/B8ja2fdk8K9w00q0em5Y4 5OkINVoc4+UWmmOsKYI+8aLXohS2/a+gUVpIXcEUG+045EnJNZEIRX2pTd/gQmbj9X mi4rc83TGdkOg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 011121000EF; Sat, 19 Aug 2023 10:39:10 -0400 (EDT) Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CB96712022A; Sat, 19 Aug 2023 10:39:09 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <83msyn37jn.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 08:50:04 +0300") Message-ID: References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83msyn37jn.fsf@gnu.org> Date: Sat, 19 Aug 2023 10:39:02 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.176 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> Personally (as a user) the functionality I'd prefer is the following: >> When the matched string does not have the same capitalization as the search >> pattern, I'd like Emacs to guess what should be the capitalization of >> the replacement and ask me to confirm its guess. > This already happens? M-% shows you the replacement in the exact > capitalization it will insert, _after_ the guesswork. And you are > already requested to confirm each replacement. So what is missing? When the guesswork is wrong I find it cumbersome to fix it. I'd like to be able to edit it right there and that the result is remembered for the next time the same capitalization is found. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 10:50:31 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 14:50:31 +0000 Received: from localhost ([127.0.0.1]:52102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXNHb-0001JM-2Q for submit@debbugs.gnu.org; Sat, 19 Aug 2023 10:50:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXNHX-0001J8-PD for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 10:50:30 -0400 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 1qXNHQ-0006dQ-8R; Sat, 19 Aug 2023 10:50:20 -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=3WftffCsEdPWjBFqLKf3L7ursRAHe7G/ML6O4sltpFc=; b=LDxBFbaQaDMm QVZoL/2dwEW3PGgt8CPmR/l7i+gCsR6XNuqWO9nLh0ncKYVzUq+6K4BEUPPsXq9NIhtyiPDFup5z8 pjoDKAs3e6pXuG70fUxr9m7/m7R8hxVJBBvrPruv4Yent+TXvRWObq/kKVbP3ZscDL7WRIIFmMFL9 S1CXS2J03jOufvG6g3kZ/6sO3BEqaPr4DB1wI669N9nKmnH6Qf8FE0FTFu6dPEk+C5j4n44wYCsC9 oZpaKHFko6Y3qjnGZ23bzpCbbeWDc/NeMw9Gs9O58quYXPkHfpgQ4g7dOdf9yqudf09XxKwLRW6KV b/EEMhzcNtHEOVPpwXcm+w==; Date: Sat, 19 Aug 2023 17:50:32 +0300 Message-Id: <83y1i7xf0n.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Sat, 19 Aug 2023 10:39:02 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83msyn37jn.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org > Date: Sat, 19 Aug 2023 10:39:02 -0400 > > >> Personally (as a user) the functionality I'd prefer is the following: > >> When the matched string does not have the same capitalization as the search > >> pattern, I'd like Emacs to guess what should be the capitalization of > >> the replacement and ask me to confirm its guess. > > This already happens? M-% shows you the replacement in the exact > > capitalization it will insert, _after_ the guesswork. And you are > > already requested to confirm each replacement. So what is missing? > > When the guesswork is wrong I find it cumbersome to fix it. > I'd like to be able to edit it right there and that the result > is remembered for the next time the same capitalization is found. If C-r is inconvenient, then I guess we need some minor variation of the existing commands e and E? And what do you mean by "remembered for the next time", when the only difference is in letter-case? From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 10:52:19 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 14:52:20 +0000 Received: from localhost ([127.0.0.1]:52107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXNJL-0001M3-JN for submit@debbugs.gnu.org; Sat, 19 Aug 2023 10:52:19 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXNJI-0001Lo-GP for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 10:52:17 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B49AD4404E2; Sat, 19 Aug 2023 10:52:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692456724; bh=v+sooDoTime2Bn9fvZpAhNGvexIOpb1Fa0o4DqgYSsA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=BU5PcpaK1sMeMJShilP8rsAG52HRCwvkL7lTyMrH/fJdCrJb6gYI+uYC+BGu7Zwp6 f5/Z+TsGP8BsP0YSlRyoYrnLe2G/v98duLwsml2JK8icjdef7wRtnR3FgQMAQgYjs/ vKksQ34ukrOgQmUE7CK50qzvY64qBQZpwTGpCk4dejaeH/FVdCJpDbfKaC6gxdeNmk pWzPKSh2Yep/gtia4n/anaivd9QDtKFl2Jjg4cSw/D2tNYhnqRE+HywQ4bieWcl8U0 ldCQb+TsX92/mm5DgKvsIiIz1Z9PXNf9TvGbwERk9qalmuk4AANp9CciYYCnRAwdUC 3Dp+bK1PLQQvA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2FE02440CAB; Sat, 19 Aug 2023 10:52:04 -0400 (EDT) Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 00CB51201E5; Sat, 19 Aug 2023 10:52:03 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: (Stefan Monnier's message of "Sat, 19 Aug 2023 10:39:02 -0400") Message-ID: References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83msyn37jn.fsf@gnu.org> Date: Sat, 19 Aug 2023 10:52:02 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.022 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Monnier [2023-08-19 10:39:02] wrote: > When the guesswork is wrong I find it cumbersome to fix it. > I'd like to be able to edit it right there and that the result > is remembered for the next time the same capitalization is found. Admittedly, another problem is that I'm usually looking at the buffer text that's about to be changed, rather than looking at the minibuffer showing me what the text will change to, so I usually notice only after the fact that the change was wrong :-( So maybe what I want is something like: 1. like we do now, highlight the text to be changed and ask y/n whether to make the change (I likely won't see the exact question in the minibuffer at that point). 2. if I say `y` but the capitalization of the change is the result of guesswork, stop right after making the change, highlight it, and ask again whether that was good, letting me edit it before continuing. Similarly when I say `!` it should stop after every change that encountered a not-yet-seen capitalization. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 11:01:26 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 15:01:26 +0000 Received: from localhost ([127.0.0.1]:52116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXNSA-0001aH-HQ for submit@debbugs.gnu.org; Sat, 19 Aug 2023 11:01:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXNS8-0001a4-II for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 11:01:25 -0400 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 1qXNS1-0008Sr-6A; Sat, 19 Aug 2023 11:01:17 -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=xFZnOtTBrIscmt3QZx2rLcdG+/LOin8m+djKc8yclpQ=; b=Yy03KrdRXCLH oOCWUjZWEcghMG82z0K/wH5ipfKkxTn8arwLdyXdnS/wcQtVoArJZLXc0ztnCUo9jzHyjQ5EIiW1X eqdRalF67lLSaah5+DBf1VBRw1lTAlOH6QkKGZZBb9cLg4rtAEdD48lqASkg5WI6Vb3l9/+xlgedw V7ASgJOjQfNT0bHoXrBb7etoiR9zzgqRawLpMcd6LfK9Ht7yA063PkhXyNmS0/kp0HQG4OxXrWVjr 9mtkfHFQO85ofdwpKGRy21hJu0Y3JgovHURRketyf+AFhVHwHTcEzx0F7mHUBzGXkchMrSJgmznD9 VJhJk/tYtjmMCfDUnAb9+w==; Date: Sat, 19 Aug 2023 18:01:29 +0300 Message-Id: <83wmxrxeie.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Sat, 19 Aug 2023 10:52:02 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83msyn37jn.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org > Date: Sat, 19 Aug 2023 10:52:02 -0400 > > So maybe what I want is something like: > > 1. like we do now, highlight the text to be changed and ask y/n whether > to make the change (I likely won't see the exact question in the > minibuffer at that point). > 2. if I say `y` but the capitalization of the change is the result of > guesswork, stop right after making the change, highlight it, and ask > again whether that was good, letting me edit it before continuing. That's what ',' does, no? > Similarly when I say `!` it should stop after every change that > encountered a not-yet-seen capitalization. Define "not yet seen capitalization". From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 11:51:57 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 15:51:57 +0000 Received: from localhost ([127.0.0.1]:52148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXOF3-0002yl-J4 for submit@debbugs.gnu.org; Sat, 19 Aug 2023 11:51:57 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:47742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXOF0-0002yW-I1 for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 11:51:56 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 188B08084F; Sat, 19 Aug 2023 11:51:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692460307; bh=4WsO+X/OfXFh+N3M1BsFX9Nl8/xaYrDEEdilkcrKgR0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=XXUk1x6ullmD/B6Ohhlopg6qV3WzJHDsSKTX/l5Atd1EpukZ0OZJpJDuBoQQIf/rS A7JhPTNAJviA8Ws41fx6jLbv7jeKCa/B0Z3aCCtH7GZnCyHCMl4Ppx3gQVGCgKYN4A KUondPnkbbE+seQFj2i7vNroRevL5xEnXNqMIs803GWyku0t3CI82k1RiPL6fNHXQN r9ZcHH6zH60A4JJ7xtlzvvdyCt8wXn7cf6O956tntMiTW8Wp7oMp+xQksWIlYnwR5y k4qebRUg0feP/Btd4buoX1lrlpJXqevK+dvZACBSKAJ5m9zp71Ixpt2qTt0fi2s0PP 8GCLzw7w7CSsA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0D6DE807D1; Sat, 19 Aug 2023 11:51:47 -0400 (EDT) Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D32AE1202C4; Sat, 19 Aug 2023 11:51:46 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <83y1i7xf0n.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 17:50:32 +0300") Message-ID: References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83msyn37jn.fsf@gnu.org> <83y1i7xf0n.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Sat, 19 Aug 2023 11:51:46 -0400 MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.023 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > And what do you mean by "remembered for the next time", when the only > difference is in letter-case? When it finds "FOo" and converts it to "Bar" and I change it to "BAr" it should remember that mapping such that next time it finds that exact same capitalization "FOo" it should use "BAr" as replacement. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 12:02:14 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 16:02:15 +0000 Received: from localhost ([127.0.0.1]:52166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXOP0-0003J5-Ki for submit@debbugs.gnu.org; Sat, 19 Aug 2023 12:02:14 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:40485) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXOOx-0003Il-LG for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 12:02:13 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 32A3D1000EF; Sat, 19 Aug 2023 12:02:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692460924; bh=LIyhfkaHuCqmBBHiOaqRMKwbxeGtT5irE8OKf6lSYgM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jh2g4PaD8QR+c9SvG2l3D7geXHbtZX2NNTq/rZVAIvlPX5aZakGJyagCTARALhY8o U4cLKMkM/c9bWWoQ+J1b70vI03Mp7foX3990ABJ9tRDkHWx8we6RSuuWC9BDM1WmaF HswXyivL0XXb9BcK6rUMCxUBfTAwZoWTjSU39wyC8mbj1vD1DOsAe8LEAP9l9M1Pvr 4ANwthcDts5YGoNkEhxy/45UOEFQHKLwTnRF7GZNqxnmuZd7rP77ms+8hGBxwej0AI PSXGnj+wfHtCY74UREzqy/ECys65cnYpphGZMCrYn3MMzq63jttHuAQoilHEDPovRy YNXem3YmhH6vA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 28B361000BD; Sat, 19 Aug 2023 12:02:04 -0400 (EDT) Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0113D120302; Sat, 19 Aug 2023 12:02:03 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <83wmxrxeie.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 18:01:29 +0300") Message-ID: References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83msyn37jn.fsf@gnu.org> <83wmxrxeie.fsf@gnu.org> Date: Sat, 19 Aug 2023 12:02:03 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.176 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> Similarly when I say `!` it should stop after every change that >> encountered a not-yet-seen capitalization. > > Define "not yet seen capitalization". I'm replacing "foo" with "bar", so at the start we know for sure: - "foo" should be replaced by "bar" - that's it, anything else is guesswork We find "Foo", it's a not-yet-seen capitalization. We propose "Bar" (which the user may accept of modify). At that point we know: - "foo" should be replaced by "bar" - "Foo" should be replaced by "Bar" (or whichever alternative the user provided instead). - that's it, anything else is guesswork When we find "fOo", it's a not-yet-seen capitalization, so we have to ask the user again, ... Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 15:14:44 2023 Received: (at 65347) by debbugs.gnu.org; 19 Aug 2023 19:14:44 +0000 Received: from localhost ([127.0.0.1]:52304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXRPH-0008AA-PE for submit@debbugs.gnu.org; Sat, 19 Aug 2023 15:14:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXRPG-00089y-NO for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 15:14:43 -0400 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 1qXRP9-00014F-3P; Sat, 19 Aug 2023 15:14:35 -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=t1VdijXXEBKdecroK990N8A4AByLLlkn/0cxcA+rZ+o=; b=rFo44t7d4E8w jG/+kiC3LVFM+Tii8/KO8RSYIiAxxRyHngF8QZGbHWnSyYZpsLV3DDvN2Rp+SNAdo4M8rO0imOOvb nbx55A4O2TZwGxyEQ84OsVOzHcFMtX3kuyhF96os4CdYHEEqbW1MjL1Y6TBxJaCm5xgg5j/hTWMGL KBHjSomhtm6g+ZRhCVXLUV+RWmpwhNHWf7siRAmtbXWcdooCcELr1mYvG+m8NuyXoXO2DEGQRMEkH 5DV0eQgOTpHNrEyVja7h/XshpF6ct5VP0QJaqcGHv90lUIMCmuO/Mjnysvayzf5jF0xkdBrSp9bn7 4daNi1bJY1PP4HSic+joXw==; Date: Sat, 19 Aug 2023 22:14:48 +0300 Message-Id: <83pm3iyhcn.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Sat, 19 Aug 2023 11:51:46 -0400) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83msyn37jn.fsf@gnu.org> <83y1i7xf0n.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org > Date: Sat, 19 Aug 2023 11:51:46 -0400 > > > And what do you mean by "remembered for the next time", when the only > > difference is in letter-case? > > When it finds "FOo" and converts it to "Bar" and I change it to "BAr" it > should remember that mapping such that next time it finds that exact > same capitalization "FOo" it should use "BAr" as replacement. Is it really what happens in these cases? IME, the capitalization patterns, when they don't fit the heuristic, are inconsistent with one another, and bumping into one such "non-standard" replacement doesn't mean all those replacements after it will be necessarily "non-standard", let alone in the same way. IOW, I believe the best strategy is to keep replacing using the default heuristic, and leave it to the user to detect the rare deviations and fix them with ',' or 'C-r'. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 20:04:09 2023 Received: (at 65347) by debbugs.gnu.org; 20 Aug 2023 00:04:09 +0000 Received: from localhost ([127.0.0.1]:52473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXVvN-00077t-E1 for submit@debbugs.gnu.org; Sat, 19 Aug 2023 20:04:09 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64439) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXVvL-00077h-Mp for 65347@debbugs.gnu.org; Sat, 19 Aug 2023 20:04:07 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id DDFEA440024; Sat, 19 Aug 2023 20:04:00 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692489835; bh=Vk+mMuoZWv0xMaREA8JDqmzhQb/rFdqgEbCerCw0HWI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=WQG4If1gq7e60j0+lakx713SEG80TRHVrO1bpI+6FTVQtvTflXQFrj/NrFRjBT1op 0pj6xtZq0L+QYYguO8cLpOEQJHh/Xd9unIXc2hQ3OvCwZXw5lrMEI1S2hPJ8C5YwxD /4OQrXZ+gNfkGcAz72GUwlE8Po0i7lSynEYGLJWu6VCfmC0Y4ZjagX45i29JHZq5d3 5kElZI8IJDAiyJv45qvsJVD2AAO+/EyASW2WTIX9XzVrnh1DCtjRHhdE5lXfZ0CTtT otbFoep1VolnSIYv0p7LwpPunABNtHqE3KK4/o6EEBZQ+aG0cyUERofXeCMEu+JJAt kySqt7magzVvQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 57B2E4413E5; Sat, 19 Aug 2023 20:03:55 -0400 (EDT) Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0CA99120298; Sat, 19 Aug 2023 20:03:54 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching In-Reply-To: <83pm3iyhcn.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Aug 2023 22:14:48 +0300") Message-ID: References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83msyn37jn.fsf@gnu.org> <83y1i7xf0n.fsf@gnu.org> <83pm3iyhcn.fsf@gnu.org> Date: Sat, 19 Aug 2023 20:03:52 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.021 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> When it finds "FOo" and converts it to "Bar" and I change it to "BAr" it >> should remember that mapping such that next time it finds that exact >> same capitalization "FOo" it should use "BAr" as replacement. > Is it really what happens in these cases? IME, the capitalization > patterns, when they don't fit the heuristic, are inconsistent with one > another, and bumping into one such "non-standard" replacement doesn't > mean all those replacements after it will be necessarily > "non-standard", let alone in the same way. I guess YMMV, but my experience is that the mapping is usually fixed (at least "per search&replace"), and in the OP's case it is as well. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 20 21:13:22 2023 Received: (at 65347) by debbugs.gnu.org; 21 Aug 2023 01:13:22 +0000 Received: from localhost ([127.0.0.1]:55083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXtTt-0007sC-LZ for submit@debbugs.gnu.org; Sun, 20 Aug 2023 21:13:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43870) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXtTq-0007rv-B0 for 65347@debbugs.gnu.org; Sun, 20 Aug 2023 21:13:19 -0400 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 1qXtTi-0007YH-MH; Sun, 20 Aug 2023 21:13:10 -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=9PZXgYx2ycMugopabocKmnG1L+5prr+5NVH95or/Gwg=; b=sIVB/NCsuLRk PgB/nBhNSjVcrqzkNwOFjQgjgkdrVjyw9NDjIfYpNi3sm0RmhM3XXuOghKgCLwE+y+AjLP/W7Fhqn EHSKfjOHT2sjSniYOcq7zypntcTntxcvHp6AUXm8+TGtlvoxWG2GdqXo9ity+UMrQO3piRs2i9r3e gz19H01/Xdc6qothzG2xMQqNTJk2vkuGbm5RgDZBggumIlmtYKkpJLXnBeFxCRJPfcT5nViUxPWUf VYZJ+c3p7mZNo5oL389xKbVZuwIOk8cgfa2iN0sv/UVHlz4wXQT4CKhoMB24HuYat9Fcw0pq9afcB yAQc4ugTz/gWRFnfbqlRKw==; Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1qXtTe-0003tl-Sk; Sun, 20 Aug 2023 21:13:08 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Eli Zaretskii In-Reply-To: <83h6ov3722.fsf@gnu.org> (message from Eli Zaretskii on Sat, 19 Aug 2023 09:00:37 +0300) Subject: Re: bug#65347: 29.1; Underscore in query replace prevents case-matching References: <838raa6syr.fsf@gnu.org> <83o7j451iu.fsf@gnu.org> <83wmxs2p52.fsf@gnu.org> <83sf8g2mrr.fsf@gnu.org> <83o7j42lq7.fsf@gnu.org> <83h6ov3722.fsf@gnu.org> Message-Id: Date: Sun, 20 Aug 2023 21:13:06 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65347 Cc: sbaugh@janestreet.com, 65347@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ 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. ]]] > Eglot can serve as the back-end, and it isn't the only one that comes > to mind (I sincerely hope that at least some of the simpler > refactoring jobs will not require an LSP, but could be done using > built-in capabilities). It is ok if Emacs has facilities to use language servers, but it would be a bad end for Emacs if it becomes dependent on language servers for its important features. -- 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) From unknown Fri Aug 15 21:27:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 18 Sep 2023 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator