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

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

bug#32173: 26.1; wdired: broken 'wdired-use-interactive-rename'


From: Stephen Berman
Subject: bug#32173: 26.1; wdired: broken 'wdired-use-interactive-rename'
Date: Sat, 21 Jul 2018 12:48:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Fri, 20 Jul 2018 22:44:31 +0300 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Enrico Scholz <enrico.scholz@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





reply via email to

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