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: Stefan Monnier
Subject: Re: Partial wdired (edit just filename at the point)
Date: Wed, 17 Mar 2021 10:09:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> 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.

> 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.

> 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.


        Stefan




reply via email to

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