Variable: undo-equiv-table

undo-equiv-table is a variable defined in simple.el.gz.

Value

#s(hash-table size 65 test eq weakness key-and-value rehash-size 1.5 rehash-threshold 0.8125 data
	      ())

Documentation

Table mapping redo records to the corresponding undo one.

A redo record for an undo in region maps to 'undo-in-region. A redo record for ordinary undo maps to the following (earlier) undo. A redo record that undoes to the beginning of the undo list maps to t. In the rare case where there are (erroneously) consecutive nil's in buffer-undo-list, undo maps the previous valid undo record to
'empty, if the previous record is a redo record, undo doesn't change
its mapping.

To be clear, a redo record is just an undo record, the only difference is that it is created by an undo command (instead of an ordinary buffer edit). Since a record used to undo ordinary change is called undo record, a record used to undo an undo is called redo record.

undo uses this table to make sure the previous command is undo. undo-redo uses this table to set the correct pending-undo-list.

When you undo, pending-undo-list shrinks and buffer-undo-list grows, and Emacs maps the tip of buffer-undo-list to the tip of pending-undo-list in this table.

For example, consider this undo list where each node represents an undo record: if we undo from 4, pending-undo-list will be at 3, buffer-undo-list at 5, and 5 will map to 3.

    |
    3 5
    | /
    |/
    4

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defconst undo-equiv-table (make-hash-table :test 'eq :weakness t)
  "Table mapping redo records to the corresponding undo one.
A redo record for an undo in region maps to 'undo-in-region.
A redo record for ordinary undo maps to the following (earlier) undo.
A redo record that undoes to the beginning of the undo list maps to t.
In the rare case where there are (erroneously) consecutive nil's in
`buffer-undo-list', `undo' maps the previous valid undo record to
'empty, if the previous record is a redo record, `undo' doesn't change
its mapping.

To be clear, a redo record is just an undo record, the only difference
is that it is created by an undo command (instead of an ordinary buffer
edit).  Since a record used to undo ordinary change is called undo
record, a record used to undo an undo is called redo record.

`undo' uses this table to make sure the previous command is `undo'.
`undo-redo' uses this table to set the correct `pending-undo-list'.

When you undo, `pending-undo-list' shrinks and `buffer-undo-list'
grows, and Emacs maps the tip of `buffer-undo-list' to the tip of
`pending-undo-list' in this table.

For example, consider this undo list where each node represents an
undo record: if we undo from 4, `pending-undo-list' will be at 3,
`buffer-undo-list' at 5, and 5 will map to 3.

    |
    3  5
    | /
    |/
    4")