unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54733: Match again in perform-replace
@ 2022-04-05 17:16 Juri Linkov
  2022-04-05 17:53 ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2022-04-05 17:16 UTC (permalink / raw)
  To: 54733

[This is a spin-off from bug#14013 and bug#53758]

There is a long-standing bug in query-replace.
The optimization that uses `match-again` and `looking-at`
ignores search-related variables such as
isearch-search-fun-function, replace-re-search-function, etc.

Here's is a test case that demonstrates the problem in current master
with the recent addition of dired-isearch-search-filenames:

1. cd /tmp; touch file1; ln -s file1 file2
2. enter Wdired and move point to the beginning of file2
3. C-M-% .* RET foo RET
4. answer `n` when asked to replace `file2`

After that the remaining part of the same line is highlighted,
i.e. the part after "file2" (that is a symbolic link) in:

  file2 -> file1

This is because the `match-again` optimization uses `(looking-at ".*")`
after the previous replacement "file2" to ask about the next replacement
of " -> file1" that ignores isearch-search-fun-function.

Also in bug#53758 Dmitry explained that xref--query-replace-1
needed such a hack to let-bind isearch-filter-predicate
because of this problem in perform-replace that uses
`looking-at` instead of `replace-re-search-function`.

So now we have two cases that require fixing perform-replace.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-06-30 17:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 17:16 bug#54733: Match again in perform-replace Juri Linkov
2022-04-05 17:53 ` Juri Linkov
2022-04-29 17:41   ` Juri Linkov
2022-05-03  7:10     ` Juri Linkov
2022-06-20 23:59       ` Dmitry Gutov
2022-06-21 17:55         ` Juri Linkov
2022-06-22  7:36           ` Juri Linkov
2022-06-24 17:25             ` Juri Linkov
2022-06-30 17:52         ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).