Most buffers have an undo list, which records all changes made
to the buffer's text so that they can be undone. (The buffers that
don't have one are usually special-purpose buffers for which Emacs
assumes that undoing is not useful. In particular, any buffer whose
name begins with a space has its undo recording off by default;
see Buffer Names.) All the primitives that modify the
text in the buffer automatically add elements to the front of the undo
list, which is in the variable
This buffer-local variable's value is the undo list of the current buffer. A value of
tdisables the recording of undo information.
Here are the kinds of elements an undo list can have:
). If position is positive, point was at the beginning of the deleted text, otherwise it was at the end. Zero or more (marker . adjustment) elements follow immediately after this element.
(sec-high sec-low microsec picosec
)represents the visited file's modification time as of when it was previously visited or saved, using the same format as
current-time; see Time of Day. A time-flag of 0 means the buffer does not correspond to any file; −1 means the visited file previously did not exist.
primitive-undouses these values to determine whether to mark the buffer as unmodified once again; it does so only if the file's status matches that of time-flag.
(nilproperty value beg
(put-text-property beg end property value)
(applydelta beg end funname
This kind of element enables undo limited to a region to determine
whether the element pertains to that region.
This function places a boundary element in the undo list. The undo command stops at such a boundary, and successive undo commands undo to earlier and earlier boundaries. This function returns
The editor command loop automatically calls
undo-boundaryjust before executing each key sequence, so that each undo normally undoes the effects of one command. As an exception, the command
self-insert-command, which produces self-inserting input characters (see Commands for Insertion), may remove the boundary inserted by the command loop: a boundary is accepted for the first such character, the next 19 consecutive self-inserting input characters do not have boundaries, and then the 20th does; and so on as long as the self-inserting characters continue. Hence, sequences of consecutive character insertions can be undone as a group.
All buffer modifications add a boundary whenever the previous undoable change was made in some other buffer. This is to ensure that each command makes a boundary in each buffer where it makes changes.
Calling this function explicitly is useful for splitting the effects of a command into more than one unit. For example,
undo-boundaryafter each replacement, so that the user can undo individual replacements one by one.
This variable is normally
nil, but the undo commands bind it to
t. This is so that various kinds of change hooks can tell when they're being called for the sake of undoing.
This is the basic function for undoing elements of an undo list. It undoes the first count elements of list, returning the rest of list.
primitive-undoadds elements to the buffer's undo list when it changes the buffer. Undo commands avoid confusion by saving the undo list value at the beginning of a sequence of undo operations. Then the undo operations use and update the saved value. The new elements added by undoing are not part of this saved value, so they don't interfere with continuing to undo.
This function does not bind