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: Thu, 18 Mar 2021 10:21:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

[ 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

> I can change it back to three smaller defuns, but I will still though
> prefer to have them following each other in the code rather than
> scattered around in wdired.el for no reason as it is now. They are not
> refered from any other code.

Sounds great, thanks.


        Stefan




reply via email to

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