unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: 54733@debbugs.gnu.org
Subject: bug#54733: Match again in perform-replace
Date: Tue, 05 Apr 2022 20:16:19 +0300	[thread overview]
Message-ID: <865ynnl9f0.fsf_-_@mail.linkov.net> (raw)

[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.





             reply	other threads:[~2022-04-05 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 17:16 Juri Linkov [this message]
2022-04-05 17:53 ` bug#54733: Match again in perform-replace 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865ynnl9f0.fsf_-_@mail.linkov.net \
    --to=juri@jurta.org \
    --cc=54733@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).