From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#72147: 30.0.60; 30.0.60; Misleading regexp highlighting in 'Q' dired command Date: Sun, 28 Jul 2024 10:29:05 +0530 Message-ID: <87r0bei02u.fsf@gmail.com> References: <87r0bsn0ok.fsf@gmail.com> <86le1xkh8w.fsf@mail.linkov.net> <87r0bpu6tn.fsf@gmail.com> <86ttggr4u5.fsf@mail.linkov.net> <87ed7k4fwd.fsf@web.de> <868qxsyq0o.fsf@mail.linkov.net> <87a5i61ztv.fsf@web.de> <8634nxjv0l.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17783"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Michael Heerdegen , 72147@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 28 07:01:22 2024 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 1sXw26-0004ST-3b for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Jul 2024 07:01:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXw1e-0008Nv-5E; Sun, 28 Jul 2024 01:00:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXw1b-0008KP-76 for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 01:00:51 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sXw1a-0007DS-VB for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 01:00:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=6cSm649ZDvABPWuKE4GuNbn5ZiAZLMrbo8xgqs1OJms=; b=kinYLC+PkbPFZE9+84tttvj6KlEXUG3H7RzJkT5KmUNr0+/QsfK0CtciY9Ac27yttV/YBgbaiUikRvcw8QMLnnFo4Owsy6GGkuVEsed1vNYWAJ/M2Fh82vqOVSJa3EnweB7Oz52kbRsdMCJ9dPXwJFbTAf7GLkSno0CyVspZson4CTYUy1psLkedHgcGmBXlb3FI+noCYT4iwfX2w1D6swLFGmQWbGH1QEKNWYJGYspZEEYZiYnzFVR+kvC0acz/O6B6p2B46P1S8kn7h8aUcv9MVqlpwjVViMwDuQTQist2kmH28EsOcNk0L4o0t6AQYBp78BuCFfqFG+PT/dKcEQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sXw1l-0004J0-Qu for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 01:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jul 2024 05:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72147 X-GNU-PR-Package: emacs Original-Received: via spool by 72147-submit@debbugs.gnu.org id=B72147.172214282916502 (code B ref 72147); Sun, 28 Jul 2024 05:01:01 +0000 Original-Received: (at 72147) by debbugs.gnu.org; 28 Jul 2024 05:00:29 +0000 Original-Received: from localhost ([127.0.0.1]:42610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXw1E-0004I6-Sd for submit@debbugs.gnu.org; Sun, 28 Jul 2024 01:00:29 -0400 Original-Received: from mail-pf1-f195.google.com ([209.85.210.195]:58497) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXw1C-0004Hr-51 for 72147@debbugs.gnu.org; Sun, 28 Jul 2024 01:00:26 -0400 Original-Received: by mail-pf1-f195.google.com with SMTP id d2e1a72fcca58-70d333d5890so2092777b3a.0 for <72147@debbugs.gnu.org>; Sat, 27 Jul 2024 22:00:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722142749; x=1722747549; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=6cSm649ZDvABPWuKE4GuNbn5ZiAZLMrbo8xgqs1OJms=; b=DOTMZJCE+x4PfaSR6c8FB0FdIkvyjXZgWIg1tEnTnfq+p86dZQuvj6jYGOtkq83rRf RtBfivW3egn9SDrtS1gtz9lcogL7+8YYWr2dHRS2KjAQuPFbil6u1+XkLUJutB+0hb45 nA5dltzYDV8X6stPBt9e5FX+A+Ap+Dv/mN4jy0UWaCWxj+yojTCEk8sSZYgz6WWvU1BF xjWObFTwO5cn7ZIOrqBox5heNtF6cjTRTVtSN985cU41r/G5/YR/qc3+ntjgzqV1x31E b92ywSgl2QSdQ58MJSW2iTWzVOx8Ot8kxcUq9fz51/WKPPfEUKturFiKZ67hMhYs45lV rp6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722142749; x=1722747549; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6cSm649ZDvABPWuKE4GuNbn5ZiAZLMrbo8xgqs1OJms=; b=wwxBE+m/Buz09lnEyGOJz2CavNBGcdTpqW54ho4SoXAhWcOCEO5zlo828kTlTCBbNi PtT/vEpMqjzhRpsMYSDqmmY69cMK3vJkesu/kGVJrULKAzP+Sw+Z09Dof+JKUPJ3xyOs tPV+Mqj98OHkMBBeaN6dinrFiNIaFcSjXgynfaXJGcB5RDWcY241AxsqrGexxbjjQFoS byd/qyTzLRy1IeYS7Xgbxw4kYpZr6yWxCBZgwrBJo0YdG+ndCjbe4cQtaFrfJRpl4NtM O5QRLx19yqYvGpwTqOIIA2+Kmc+i203SuMtjUketsujvSMHB778wVD7uumH1wX13s5sm Tkhg== X-Forwarded-Encrypted: i=1; AJvYcCWGG76Hx0jjytaHcDXN/ZTEQk1TbnS/eUSAWdLEP/m+8/jms/61pFEyMEblyqQavoh+rcR1kplo+sQYG9eOw2wvy75eMlw= X-Gm-Message-State: AOJu0Ywyqp2AGibQcKkXfRJHY2h+69Xy3XM+mL5g5jsEPk2Bn6qIXeJu Ktmc5fdMcLZpGwWdRnVxpsiHp54vURCqSpQXi8qkJrRx0j5XQZ838UVr5Xqk X-Google-Smtp-Source: AGHT+IEgMWFDncq5m/bIu1a2ZFQLffmTvQzlKKndHn7wZQPKGtw9q0PUev80qpPZTv6kwAgacuOL1A== X-Received: by 2002:a05:6a00:9482:b0:70b:2531:1359 with SMTP id d2e1a72fcca58-70ecea19bc7mr5375998b3a.10.1722142749135; Sat, 27 Jul 2024 21:59:09 -0700 (PDT) Original-Received: from localhost ([49.204.119.35]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70ead89fac7sm4838106b3a.186.2024.07.27.21.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jul 2024 21:59:08 -0700 (PDT) In-Reply-To: <8634nxjv0l.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 25 Jul 2024 21:08:42 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:289456 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=E0=AF=8D =E0=AE=9C= =E0=AF=82=E0=AE=B2=E0=AF=88 25, 2024] Juri Linkov wrote: >>> > Wouldn't it be better to add a new optional argument NO-HIGHLIGHT to >>> > `query-replace-read-args', for stylistic reasons? >>> >>> It's not clear how such arg should be combined with >>> `query-replace-lazy-highlight' in `query-replace-read-args': >>> >>> (defun query-replace-read-args (prompt regexp-flag &optional noerror no= -highlight) >>> ... >>> (from (minibuffer-with-setup-hook >>> (minibuffer-lazy-highlight-setup >>> :highlight query-replace-lazy-highlight >>> >>> with `and'? With `or'? With `xor'? >>> `(and query-replace-lazy-highlight (not no-highlight))'? >> >> The installed patch binds query-replace-lazy-highlight to nil and >> shadows the old binding. This would correspond to >> >> (and query-replace-lazy-highlight (not no-highlight)) >> >> which looks reasonable in this case: we just an argument to inhibit >> highlighting. Because we never want highlighting in some cases (like >> here). > > Agreed, let's add a new argument. So how about the attached patch? --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-new-optional-argument-NO-HIGHLIGHT-to-query-repl.patch >From 17a6b4e86887235fcd5ab324ffab1d26eb90612f Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Sun, 28 Jul 2024 10:27:33 +0530 Subject: [PATCH] Add new optional argument NO-HIGHLIGHT to query-replace-read-args * lisp/replace.el (query-replace-read-args): Add new optional argument to disable regexp highlighting. * lisp/dired-aux.el (dired-do-query-replace-regexp) (dired-do-replace-regexp-as-diff) (dired-do-find-regexp-and-replace): Revert last change, and use the new argument instead. (bug#72147) --- lisp/dired-aux.el | 19 ++++++++----------- lisp/replace.el | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index decd9702eaf..cd948bd7dd9 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3801,10 +3801,9 @@ dired-do-query-replace-regexp If you exit the query-replace loop (\\[keyboard-quit], RET or q), you can resume the query replace with the command \\[fileloop-continue]." (interactive - (let* ((query-replace-lazy-highlight) - (common - (query-replace-read-args - "Query replace regexp in marked files" t t))) + (let ((common + (query-replace-read-args + "Query replace regexp in marked files" t t t))) (list (nth 0 common) (nth 1 common) (nth 2 common))) dired-mode) (dolist (file (dired-get-marked-files nil nil #'dired-nondirectory-p nil t)) @@ -3826,10 +3825,9 @@ dired-do-replace-regexp-as-diff The replacements are displayed in the buffer *replace-diff* that you can later apply as a patch after reviewing the changes." (interactive - (let* ((query-replace-lazy-highlight) - (common - (query-replace-read-args - "Replace regexp as diff in marked files" t t))) + (let ((common + (query-replace-read-args + "Replace regexp as diff in marked files" t t t))) (list (nth 0 common) (nth 1 common) (nth 2 common)))) (dired-post-do-command) (multi-file-replace-regexp-as-diff @@ -3903,10 +3901,9 @@ dired-do-find-regexp-and-replace Also see `query-replace' for user options that affect how this function works." (interactive - (let* ((query-replace-lazy-highlight) - (common + (let ((common (query-replace-read-args - "Query replace regexp in marked files" t t))) + "Query replace regexp in marked files" t t t))) (list (nth 0 common) (nth 1 common))) dired-mode) (require 'xref) diff --git a/lisp/replace.el b/lisp/replace.el index 01a892bbba7..2285b19b519 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -352,7 +352,7 @@ query-replace-read-to to)) regexp-flag)) -(defun query-replace-read-args (prompt regexp-flag &optional noerror) +(defun query-replace-read-args (prompt regexp-flag &optional noerror no-highlight) (unless noerror (barf-if-buffer-read-only)) (save-mark-and-excursion @@ -364,7 +364,7 @@ query-replace-read-args :filter (when (use-region-p) (replace--region-filter (funcall region-extract-function 'bounds))) - :highlight query-replace-lazy-highlight + :highlight (and query-replace-lazy-highlight (not no-highlight)) :regexp regexp-flag :regexp-function (or replace-regexp-function delimited-flag -- 2.45.2 --=-=-=--