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: Fri, 19 Mar 2021 12:15:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> As you can guess from the previous comment, we should loop over BEG...END
>>> to process all the lines involved.
>> Can you elaborate more on this please?
>
> Because that's how `before-change-functions` is defined.  We can try and
> argue that in the specific case of wdired buffer the multiline case will
> never happen (presumably because of all the `read-only` annotations) or
> that it will always be "on the same line as point", but I'm pretty sure
> we'll end up finding corner cases where these are not true, so I find it
> easier to slap a simple while loop around the code and stop worrying
> about corner cases.

Ok, thanks for the explanation.

> [ As a general rule, I find it easier to write code if I just rely on
>   the few things which I know to be true, rather than having to think of
>   a set of unbounded possible cases.  Here, what we know to be true is
>   that the upcoming changes will not affect anything outside BEG...END
>   (at least not until `before-change-functions` are called again).  ]
>
>> This is what I got for each char I typed in:
>
> Try something like
>
>     M-: (subst-char-in-region (point-min) (point-min) ?. ?-) RET

Indeed, I was only concentrated on "interactive" editing, didn't thought
so much of other elisp functions.

Jere is a sketch with region, however, I am not able to get
editing permissions correctly. I am not really sure what is going on.

Maybe you or someone else see what is wrong there. Otherwise editing
names and symlinks works fine. I hope the general "setup" to loop
through the region is acceptable. I have attached my working file and as
a patch so take a look at whichever is easier.

Attachment: partial-wdired.el
Description: Text document

Attachment: 0001-Lazy-wdired-preprocessing.patch
Description: Text Data


reply via email to

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