emacs-devel
[Top][All Lists]
Advanced

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

undoing changes automatically


From: Roland Winkler
Subject: undoing changes automatically
Date: Mon, 12 Nov 2007 02:13:01 +0100

Who can please explain to me the following?

bibtex.el contains the function bibtex-format-entry that performs
various formatting operations on a BibTeX entry. Along the way, it
also checks in several ways whether syntax and content of the entry
are correct. It throws an error if any of these checks indicates
that something is incorrect. But this happens while it is in the
midst of its formatting job. This is very confusing because it
leaves the buffer in an odd state. One always needs to do an `undo'
after such an error message.

So I want to put the call to undo in the code such that it undoes
all the formatting before it throws the error.

However, one thing confuses me: a simple call of `undo' is not
enough. Instead, I need to call first `undo-boundary'. Why does
`undo' ignore the latest entries in buffer-undo-list past (i.e.,
newer than) the last undo boundary? Is this behavior intended? If
yes, is it documented somewhere?

Thanks,

Roland

PS: I am also a bit unhappy that using the buffer-undo-list for this
always makes this list grow, although there is no need to keep these
entries in buffer-undo-list if they are undone immediately. So is
there a cleaner way to achieve what I want? I have in mind something
like a (noninteractive) undo function that deletes those entries
from buffer-undo-list that are undone. (An alternative would be that
the code performed first all the error checking and did the
formatting afterwards. However, this would duplicate a lot of code
and also duplicate work done in bibtex-format-entry. So I would like
to avoid that.)




reply via email to

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