Ignacio Casso <ignacioca...@hotmail.com> writes:

> I've written a patch proposal. It deals with buffer-modified-p and undo
> history, but not the other two points you mention. I have tested it and
> it works, but I had never dealt before with `buffer-undo-list' so maybe
> there are some cases that I have not considered and for which this patch
> could be problematic. Let me know what you think:

Thanks!

> -               (delete-and-extract-region (point) (point-max)))))))
> +               (undo-boundary)

> +           (setq buffer-undo-list
> +                 (seq-drop-while 'identity buffer-undo-list)))))))

This looks fragile and can be disasterous when buffer-undo-list is
large.

Maybe just use with-silent-modifications or some ideas from there (for
example, wrapping modifications inside let-bound (buffer-undo-list t))?
We should not inhibit modification hooks though. Otherwise, it will mess
up with caching code.

Best,
Ihor

Reply via email to