GNU bug report logs -
#32173
26.1; wdired: broken 'wdired-use-interactive-rename'
Previous Next
Reported by: Enrico Scholz <enrico.scholz <at> ensc.de>
Date: Mon, 16 Jul 2018 13:30:02 UTC
Severity: normal
Found in version 26.1
Done: Stephen Berman <stephen.berman <at> gmx.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Fri, 20 Jul 2018 22:44:31 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Enrico Scholz <enrico.scholz <at> ensc.de>
>> Date: Mon, 16 Jul 2018 15:28:29 +0200
>>
>> wdired seems to misbehave when 'wdired-use-interactive-rename' is
>> active:
[...]
> It looks like the code expects you to delete the entire original name
> and then type the new name from scratch, it doesn't expect to see part
> of the old file name unaltered.
>
> Does the patch below give good result?
>
> diff --git a/lisp/wdired.el b/lisp/wdired.el
> index bb60e77..13005cb 100644
> --- a/lisp/wdired.el
> +++ b/lisp/wdired.el
> @@ -550,7 +550,11 @@ wdired-search-and-rename
> (progn
> (setq done t)
> (let ((inhibit-read-only t))
> - (dired-move-to-filename)
> + ;; Can't use dired-move-to-filename, because editing
> + ;; the file names could have left the 'dired-filename'
> + ;; property only on part of the file name.
> + (re-search-forward directory-listing-before-filename-regexp
> + (line-end-position) t)
> (search-forward (wdired-get-filename t) nil t)
> (replace-match (file-name-nondirectory filename-ori) t t))
> (dired-do-create-files-regexp
AFAICT this patch avoids the bug and is simpler than the fix I proposed
(https://lists.gnu.org/archive/html/bug-gnu-emacs/2018-07/msg00602.html).
But with the above patch, if the user types C-g when prompted to make
the replacement, the file name is left partly or wholely without the
dired-filename text property. I'm not sure if that's a problem, that's
why in my patch I restored the property. I note the current buggy code
has the same issue.
Steve Berman
This bug report was last modified 6 years and 349 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.