emacs-devel
[Top][All Lists]
Advanced

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

Re: The *Warnings* buffer and undo


From: Miles Bader
Subject: Re: The *Warnings* buffer and undo
Date: Fri, 30 Mar 2007 07:07:22 +0900

Richard Stallman <address@hidden> writes:
>     Otherwise undo information will be recorded sparsely (for example, for
>     user input), leading to inconsistent results.
>
> That was my first reaction, but then it occurred to me that recording
> undo info only for user editing might be just the right thing.

There's already another thread on exactly this topic (see the subject
"A new(?) warning of erase-buffer, which was not seen before.").  I want
to add this feature for comint, and ERC already uses it.

Basically you can't just bind buffer-undo-list; there are complications
because undo information holds absolute positions (not, e.g., markers).
If any changes are shielded from the undo recording mechanism, the
positions in buffer-undo-list get screwed up.

Possible solution to this problem are:

  (1) Instead of binding buffer-undo-list, have special insert/delete
      functions that do the operation and then update buffer-undo-list
      accordingly.  This only works if you have control over all the
      relevant insert/delete calls.

  (2) Have an explicit function for fixing up buffer-undo-list.  The
      caller would then let-bind buffer-undo-list around the
      insertions/deletions and then call the function to fix things up.
      This only would work if it's very simple to describe (to the fixup
      function) where the ignored operations happened; that might be
      true of e.g., comint, but maybe not in other contexts.

  (3) Modify the emacs insert/delete primitives to do the job, e.g.,
      they could look for a variable like `inhibit-undo', and if
      non-nil, fixup buffer-undo-list to account for the new operation
      instead of actually recording the new operation in it.

All of this for after the release of course. :-)

-Miles

-- 
Love is a snowmobile racing across the tundra.  Suddenly it flips over,
pinning you underneath.  At night the ice weasels come.  --Nietzsche




reply via email to

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