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: Tue, 16 Mar 2021 22:34:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Never used 'before-change-function, so I didn't think about it :).
>
> Sure, as a strategy it sounds good indeed, but I am not sure I
> understand how to apply that hook in this case. Docs says it is called
> before any buffer mdification, but I am not sure what it means: before
> every key-press in this case or what is ment with buffer modification here?

Not "before a key press" because it can't know you're about to press
a key, and even if it knows, it can't easily know what that command
will do.

So instead it's done at the beginning of those ELisp primitives that
modify a buffer, like `delete-region`, or `insert`.

It can be called several times in a single command, depending on what
the command does, so it's best to optimize function placed on this hook
such that they are usually very cheap.

>> This way entering `wdired` should be instantaneous but you can still
>> edit any line you like.  The actual edits would be slightly slowed down,
>> but that shouldn't be nearly as problematic.
>
> I agree it shouldn't be noticable; it is how the implementation I
> attached works; it is just that I do it explicitly with a "manual"
> call to function that change properties just for the line at the point.

Yes, I understand, but I think we can have our cake and eat it too: be
super-fast when editing only a single line yet without having to tell
Emacs in advance whether we plan to edit only a single line or all
the lines.


        Stefan




reply via email to

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