bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49124: Wdired doesn't like re-search-forward/replace-match


From: Eduardo Ochs
Subject: bug#49124: Wdired doesn't like re-search-forward/replace-match
Date: Sat, 19 Jun 2021 21:33:37 -0300

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 via email to

[Prev in Thread] Current Thread [Next in Thread]