unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eduardo Ochs <eduardoochs@gmail.com>
To: 49124@debbugs.gnu.org
Subject: bug#49124: Wdired doesn't like re-search-forward/replace-match
Date: Sat, 19 Jun 2021 21:33:37 -0300	[thread overview]
Message-ID: <CADs++6imWzL9TV79NAbd92QDZSan9jYK2uGvx8iE3XGv2qNQeg@mail.gmail.com> (raw)

Here's how to see the bug in action. Define `foo' by executing this
defun:

  (defun foo (s e)
    "Replace all `a's by `b's in the region."
    (interactive "r")
    (save-excursion
      (save-restriction
        (narrow-to-region s e)
        (goto-char (point-min))
        (while (re-search-forward "a" nil 'noerror)
          (replace-match "b" 'fixedcase 'literal)))))

and run this to create a directory /tmp/foo with some scratch files:

  rm -Rv /tmp/foo/
  mkdir  /tmp/foo/
  cd     /tmp/foo/
  touch aaaa
  touch aaaaa
  touch aaaaaa

Visit /tmp/foo/ in dired mode, and run `M-x
wdired-change-to-wdired-mode' to switch to wdired mode. Mark a region
with two "aa"s in the middle of one of the file names, and run `M-x
foo'. The first "a" will be changed to a "b" and `foo' will abort with
the error message "Text is read-only" - not good. Leave wdired with
`C-c C-c'. The "a" that was changed to a "b" will be reverted back to
an "a", and wdired will display the message "(No changes to be
performed)" - not good again.

Tested with this version of Emacs:

  GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
  3.24.5, cairo version 1.16.0) of 2021-06-08

on a Debian box, with:

  ~/bigsrc/emacs28/src/emacs \
    -T emacs28 -fg bisque -bg black -fn 6x13 \
    -Q ~/TODO

I told Emacs to ignore the local variables list in my ~/TODO file.

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev
    edrx at irc.libera.chat





             reply	other threads:[~2021-06-20  0:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-20  0:33 Eduardo Ochs [this message]
2021-06-20  1:28 ` bug#49124: Wdired doesn't like re-search-forward/replace-match Michael Heerdegen
2021-06-20  1:45   ` Eduardo Ochs
2021-06-20  2:12     ` Michael Heerdegen
2021-06-21 13:11       ` Lars Ingebrigtsen
2021-06-21 21:59         ` Michael Heerdegen
2021-07-19 17:04           ` Lars Ingebrigtsen

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=CADs++6imWzL9TV79NAbd92QDZSan9jYK2uGvx8iE3XGv2qNQeg@mail.gmail.com \
    --to=eduardoochs@gmail.com \
    --cc=49124@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).