From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73018: 31.0.50; wdired + replace-regexp only modifies the visible portion of the buffer Date: Mon, 09 Sep 2024 16:55:59 +0200 Message-ID: <87bk0w511c.fsf@web.de> References: <20240904.080321.1100373523429404965.enometh@meer.net> <87seug85hh.fsf@web.de> <86y147gzx0.fsf@mail.linkov.net> <874j6uz4d8.fsf@web.de> <86ed5yujq3.fsf@mail.linkov.net> <87v7z9rnrp.fsf@web.de> <87o750dats.fsf@web.de> <868qw2ruv3.fsf@mail.linkov.net> Reply-To: Michael Heerdegen 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="19261"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Madhu , 73018@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 09 16:56:40 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 1snfom-0004o9-8K for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 Sep 2024 16:56:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snfoM-00062F-SG; Mon, 09 Sep 2024 10:56:14 -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 1snfo6-0004sK-8U for bug-gnu-emacs@gnu.org; Mon, 09 Sep 2024 10:56:01 -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 1snfo5-0007J1-Vh for bug-gnu-emacs@gnu.org; Mon, 09 Sep 2024 10:55:58 -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=No1HdJHcdhzpWZ3UXOh0+mU8JnXgZ5QgfwzIctccaW4=; b=XKLzQjivf6xwiac8B8KOi7qTh9NrC2VOZWfjEF2gtceX3i7U1vIUNhGSbElK5c6s24hhwJpxzrl3A97PfJtMosKkcimDxLRDuGiNb54XTXpF0GWbw9V5FJtvQPZDlavxIIdVnOtUtWDWOp5iTpJ/6Qcu8kkx3Fu/bPfFRFfUmY6VqZCgSIaXd+Fw/332e92YwZlxMqQTJTPlNUDTtSq+JzNCuSmRMZzcj2/XiSRDTpQPunLoSTcG+93YJUQbQD0RLw2UYVY2VJkH1m0uha/36aTSsIelyeB6hUxGR6WWbQbuJbVZrtQAlBazlQxdu9XjPSymkWf2M+5MQkDPJOOpTg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1snfo9-0002Sf-Jo for bug-gnu-emacs@gnu.org; Mon, 09 Sep 2024 10:56:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Sep 2024 14:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73018 X-GNU-PR-Package: emacs Original-Received: via spool by 73018-submit@debbugs.gnu.org id=B73018.17258937269413 (code B ref 73018); Mon, 09 Sep 2024 14:56:01 +0000 Original-Received: (at 73018) by debbugs.gnu.org; 9 Sep 2024 14:55:26 +0000 Original-Received: from localhost ([127.0.0.1]:33860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snfna-0002Rl-D7 for submit@debbugs.gnu.org; Mon, 09 Sep 2024 10:55:26 -0400 Original-Received: from mout.web.de ([212.227.17.11]:53755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snfnX-0002RV-H5 for 73018@debbugs.gnu.org; Mon, 09 Sep 2024 10:55:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1725893708; x=1726498508; i=michael_heerdegen@web.de; bh=No1HdJHcdhzpWZ3UXOh0+mU8JnXgZ5QgfwzIctccaW4=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=VTCSUw/nh3cZAoaKM2UP3KrGCfYWSpL4cFf7o4vPp2bD6TUDyJTm+uNPgviUrj78 Q6i0UYgHNHa+h1H4yDbDWf8Nc0Gkow7O4mfVWZTLM+S6WTbhBac8f5E9/ucjIAIdq ZzPAoFPTR+l0otq43jQvP4weOtFfuFszAaD0QSWDBXIcp7J2XTy8hz+IgUtci1pMS +LolLZpGcIFjVCdupWEkCnDxTnDP303tY+GcrS4Cq6U2z8ibPoaTcVaNRywsSZuzH ozy/iNTM3RpFXHfJwSsnCXmcOPrnrVx/e7MYqaFPZNRF/pUBGjukG2KYsiKKIXdRL i8btJ2GYlyUmePxN8w== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([84.59.210.176]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N3Gki-1s5Mwo1jXu-00x8jH; Mon, 09 Sep 2024 16:55:08 +0200 In-Reply-To: <868qw2ruv3.fs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bhNCpIgnbC/bu pFEUGNweQl0BHIRLLj/BBTxFJDNhhtr5GCHKPzkXGHoBtHdvDat3LAK7udnPh+NYXGSV5rBj 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:291508 Archived-At: --=-=-= Content-Type: text/plain Juri Linkov writes: > M-: (buffer-substring (- (point-max) 2) (- (point-max) 1)) > => #("7" 0 1 (fontified nil invisible dired-hide-details-link)) > > M-> ;; (end-of-buffer) > > M-: (buffer-substring (- (point-max) 2) (- (point-max) 1)) > => #("7" 0 1 (face default dired-symlink-filename t fontified t > invisible dired-hide-details-link)) > > And indeed, after going to the end of the Dired buffer > the last file gets an additional property `dired-symlink-filename' > used by Isearch/Replace. So, the properties we use are of different types: some are already attached by `dired-insert-set-properties', others later by font-lock (see `dired-font-lock-keywords'). AFAIR this is because some tests are more expensive than others (e.g. the test whether a link is broken) and are intentionally delayed. Would something like this be good? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-WIP-Bug-73018.patch Content-Transfer-Encoding: quoted-printable =46rom c5ef8c8db7d8b2ab03998a0f3f2a1b820ff24e2a Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Mon, 9 Sep 2024 16:46:13 +0200 Subject: [PATCH] WIP: Bug#73018 =2D-- lisp/dired-aux.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index d79ec342435..77dde7147bc 100644 =2D-- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3740,8 +3740,12 @@ dired-isearch-search-filenames The returned function narrows the search to match the search string only as part of a file name enclosed by the text property `dired-filename= '. It's intended to override the default search function." - (isearch-search-fun-in-text-property - (funcall orig-fun) '(dired-filename dired-symlink-filename))) + (let ((search-fun + (isearch-search-fun-in-text-property + (funcall orig-fun) '(dired-filename dired-symlink-filename)))) + (lambda (&rest args) + (font-lock-ensure) + (apply search-fun args)))) ;;;###autoload (defun dired-isearch-filenames () =2D- 2.39.2 --=-=-= Content-Type: text/plain A related question is whether everybody always wants to search in symlink targets when isearching file names in dired... I don't. Would it be worth to add an option for that? Currently the properties are just hardcoded. Then, in the above patch we could make the `font-lock-ensure' call depend on the value of that option. > Also noticed that doing the first replacement always raises an error: > > Debugger entered--Lisp error: (error "Match data clobbered by buffer > modification hooks") > replace-match("!" nil nil) > replace-match-maybe-edit("!" nil nil nil (672 673 #) nil) > perform-replace("7" "!" t t nil nil nil nil nil nil nil) > query-replace-regexp("7" "!" nil nil nil nil nil) > funcall-interactively(query-replace-regexp "7" "!" nil nil nil nil nil) > command-execute(query-replace-regexp) Do I interpret the code in replace_match correctly: this error doesn't even mean the match data has been clobbered - only that modification hooks called searching functions? I don't know what the referenced search_regs.num_regs exactly contains. But we already seem to ensure not to clobber match data. Michael. --=-=-=--