[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 20:56:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
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.
partial-wdired.el
Description: Text document
- Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/16
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/16
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/16
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/16
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/17
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/17
- Re: Partial wdired (edit just filename at the point),
Arthur Miller <=
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/17
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/17
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/18
- Re: Partial wdired (edit just filename at the point), Thierry Volpiatto, 2021/03/18
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/18
- Re: Partial wdired (edit just filename at the point), Thierry Volpiatto, 2021/03/18
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/18
- Re: Partial wdired (edit just filename at the point), Michael Heerdegen, 2021/03/23
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/18
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/19