emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unbalanced change hooks (part 2)


From: Eli Zaretskii
Subject: Re: Unbalanced change hooks (part 2)
Date: Tue, 02 Aug 2016 17:44:34 +0300

> Date: Mon, 1 Aug 2016 20:52:23 +0000
> Cc: address@hidden, address@hidden, address@hidden
> From: Alan Mackenzie <address@hidden>
> 
> (i) Abandon the use of before-change-functions.
> (ii) Enable undo in pre-command-hook, if necessary.
> (iii) At each after-change-functions call:
>   a - Analyze buffer-undo-list down as far as (or pos (next-nil)), and
>     revert the insertion or deletion which as been made, taking
>     particular care over coalesced multiple insertions/deletions.
>   b - (setq pos (current-position-in-undo-list))
>   c - Perform what used to be before-change actions.
>   d - restore the insertion/deletion.
>   e - Perform the normal after-change functions.
> (iv) Disable undo in post-command-hook, if appropriate.

What I don't get is why do you need to look at the deleted text.  The
after-change-functions called after deletion tells you which buffer
positions were removed, so any data CC Mode holds in its caches about
those positions should be discarded.  Why do you need to actually look
at the removed text itself?  What am I missing?

Regarding the proposal itself, undoing arbitrary changes might be
expensive, both CPU- and memory-wise.



reply via email to

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