emacs-devel
[Top][All Lists]
Advanced

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

Re: Partial wdired (edit just filename at the point)


From: Arthur Miller
Subject: Re: Partial wdired (edit just filename at the point)
Date: Wed, 17 Mar 2021 23:40:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Arthur Miller <arthur.miller@live.com> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> The problem here is how aborting changes is implemented in wdired: undo
>>> is disabled and original code just copies entire buffer and pastes it back
>>> when changes are aborted.
>>
>> I think you should be able to leave this part of the code completely 
>> unchanged.
>
> Yes; and for the simplicity it will be so.
>
>>> I would like to skip copying entire buffer into buffer-string as
>>> wdired does originally.
>>
>> Any particular reason for that?  It should be very fast, even for very
>> large directories.
>
> Just for efficiency; it copies entire buffer which can be quite big
> memory wise; but indeed it seems to be very fast, and I guess for the
> simplicity of implementation it can be left as is :-).
>
>>> I agree with you, but I am not sure how to implement it. My hack was
>>> literally less than a 5 minute change, I just removed loops and changed
>>> mode name so I can abort it properly.
>>
>> I'd start with the following:
>> When converting to wdired, instead of calling `wdired-preprocess-files`, use
>>
>>     (add-hook 'before-change-functions #'wdired--preprocess-lines nil t)
>>
>> and then turn `wdired-preprocess-files` into `wdired--preprocess-lines`,
>> which will `get-text-property` of the first char of each line in the
>> region to see if it's already been marked as `read-only`.  If yes,
>> do nothing and if not, do what the old code did on that line.
>
> I tested, and currently I don't see any noticable slowdowns, even on
> that large directory. Dropping into wdired seems to be quite reactive
> and I can start editing any file name immidiately.
>
> However I can't seem to be able to get it work with permissions; I am
> not sure why. I have checked that wdired-allow-to-change-permissions is t.
>
> I have attached code as a separate file (I worked so). I can make a
> patch for wdired.el later, if you or someone can give me a tip why text
> props for permissions are not changing as they should.

I change my mind :-) I have tested with emacs -Q option, and I see same
behaviour with permission properties with original wdired code, so I
guess it works properly (or as buggy as original). Someone please test
it though.

Attached is a patch for wdired based on current master.

Attachment: lazy-wdired.patch
Description: Text Data


reply via email to

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