all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* guaranteed undo boundaries
@ 2013-02-07  2:53 Roland Winkler
  2013-02-07 13:45 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Winkler @ 2013-02-07  2:53 UTC (permalink / raw)
  To: emacs-devel

Is it possible to set up a command or function foo such that one may
rely upon the fact that all changes performed by foo in a buffer
when foo is called once, will be undone calling undo exactly once in
this buffer?

I know the function undo-boundary. I also know the macro
atomic-change-group. Yet in both cases I am not sure from the
docstring / the elisp manual whether one may rely on the fact that
each call of foo gives exactly one undo boundary.

The context of my question is BBDB. Here it is crucial that each
change to the buffer visiting the database must be carried out such
that the database remains in a well-defined state. Half a change
gives a corrupted database. Therefore, each function performing any
such changes in this buffer is doing its job such that when the
function has completed its job BBDB is again in a well-defined
state. (For modifying the buffer visiting the database, these
functions only use insert, insert-before-markers, delete-region and
delete-char.)

Yet currently BBDB does not provide any possibility to undo changes
in its database (meaning first of all: undoing changes in the buffer
visiting the database, which then need to propagate back into BBDB).
I thought that I could add at least some rudimentary undo feature if
each function that changes the database gives exactly one boundary
in buffer-undo-list. So if one undoes changes of the buffer one by
one, the database always remains in a well-defined state.

Possibly this is already guaranteed, merely this could be spelled out
more explicitly in some docstring / the elisp manual. Possibly, I am
missing something else.

Roland

PS: A proper command bbdb-undo will require yet more than the above.
Please do not expect that such a feature will find its way into BBDB
in the near future.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-07 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-07  2:53 guaranteed undo boundaries Roland Winkler
2013-02-07 13:45 ` Stefan Monnier
2013-02-07 14:52   ` Roland Winkler
2013-02-07 16:28     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.