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

From: Stephen Berman <[email-masked]>
Date: Thu, 26 Jul 2018 09:54:10 +0200

On Sun, 22 Jul 2018 01:38:44 +0200 Stephen Berman <[email-masked]> wrote:

> On Sat, 21 Jul 2018 15:06:19 +0300 Eli Zaretskii <[email-masked]> wrote:
>
>>> From: Stephen Berman <[email-masked]>
>>> Cc: Enrico Scholz <[email-masked]>,  [email-masked]
>>> Date: Sat, 21 Jul 2018 12:48:57 +0200
>>> 
>>> 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.
>>
>> Right.  But I think we had better did this more thoroughly, so I think
>> your solution (which I somehow managed to miss) is better.  Please
>> wait for a few days and push to emacs-26 if no problems are reported
>> with your patch.
>
> Thanks, but...
>
> On Sat, 21 Jul 2018 15:19:36 +0300 Eli Zaretskii <[email-masked]> wrote:
>
>> Btw, what happens in the non-interactive rename case, wrt the
>> dired-filename property?  If the renamed file is left with part of it
>> covered by that property, we may have a broader problem in wdired.el.
>
> That's a good question (which didn't occur to me).  With
> wdired-use-interactive-rename nil (the default), a partially edited
> filename is indeed only partly covered by the dired-filename property,
> but as soon as you type C-c C-c or C-x C-s the change is saved and the
> buffer returns to dired-mode, which makes the whole file name
> propertized again.  So that's no problem.  However, there could be a
> problem before saving the change if some function looks for the
> dired-filename property -- and in fact, there is such a function:
> dired-isearch-filenames in dired-aux.el.  And indeed, you can use this
> in wdired-mode after editing file names but before saving the changes,
> and then the search will fail if the search string includes characters
> now lacking the dired-filename property.
>
> The only way I could think of to avoid this is to restore the text
> property via after-change-functions, as in the patch below.
[...]

Just pinging in case this has fallen under your radar.  No sweat if you
haven't had time to review it or are waiting for a reaction from the OP.

Steve Berman