From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#52558: Option for easier typing of regexps Date: Sun, 19 Dec 2021 20:48:18 +0200 Organization: LINKOV.NET Message-ID: <86wnk0ctxp.fsf@mail.linkov.net> References: <86v8zkkgxn.fsf@mail.linkov.net> <8635moe8z1.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39787"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 52558@debbugs.gnu.org To: ndame Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 19 19:50:32 2021 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 1mz1GR-000A7V-EN for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 19:50:31 +0100 Original-Received: from localhost ([::1]:53500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mz1GP-0003Mv-0O for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 13:50:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mz1Fz-0003KW-9v for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 13:50:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36564) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mz1Fy-000155-RR for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 13:50:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mz1Fy-0003ED-OL for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 13:50:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Dec 2021 18:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52558 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 52558-submit@debbugs.gnu.org id=B52558.163993974312296 (code B ref 52558); Sun, 19 Dec 2021 18:50:02 +0000 Original-Received: (at 52558) by debbugs.gnu.org; 19 Dec 2021 18:49:03 +0000 Original-Received: from localhost ([127.0.0.1]:48102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mz1F0-0003CG-T2 for submit@debbugs.gnu.org; Sun, 19 Dec 2021 13:49:03 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:65493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mz1Ey-0003Bm-RU for 52558@debbugs.gnu.org; Sun, 19 Dec 2021 13:49:01 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id C479C40004; Sun, 19 Dec 2021 18:48:53 +0000 (UTC) In-Reply-To: <8635moe8z1.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 19 Dec 2021 20:38:10 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222740 Archived-At: >>> Such option already exists, and it allows using custom regexp syntax >>> both for isearch and query-replace: >> >> Interesting, though its help mentions only isearch, so if I start >> M-x query-replace-regexp directly, it doesn't seem affected. > > If you want to use M-x query-replace directly, > then simpler would be add replace-regexp-function > that you can use with: > > (setq replace-regexp-function And additional change is needed for correct highlighting: diff --git a/lisp/replace.el b/lisp/replace.el index 0e81b15a09..4302868520 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2690,7 +2693,8 @@ replace-highlight (if query-replace-lazy-highlight (let ((isearch-string search-string) (isearch-regexp regexp-flag) - (isearch-regexp-function (or delimited-flag + (isearch-regexp-function (or replace-regexp-function + delimited-flag (and replace-char-fold (not regexp-flag) #'char-fold-to-regexp)))