Download
(defun cdddr (lst) (cdr (cddr lst)))
(defun cadddr (lst) (cadr (cddr lst)))
(defun cddddr (lst) (cddr (cddr lst)))
(defun undo-elt-to-string (elt)
"Convert one element on an undo list to a string.
See the Emacs LISP manual for the patterns matched. The string describes
what was done to create the element: \"i\" for insertion, \"d\" for deletion,
\"*\" for setting or updating the modification time, \"p\" for a property
change, \"m\" for marker motion, \"/\" for a command boundary, \"?\" for
anything else."
(cond
((integerp elt) ".")
((and (listp elt)
(integerp (car elt))
(integerp (cdr elt))) "i")
((and (listp elt)
(stringp (car elt))
(integerp (cdr elt))) "d")
((and (listp elt)
(listp (cdr elt))
(eq (car elt) t)
(integerp (cadr elt))
(integerp (cddr elt))) "*")
((and (listp elt)
(listp (cdr elt))
(listp (cddr elt))
(listp (cdddr elt))
(null (car elt))
(integerp (cadddr elt))
(integerp (cddddr elt))) "p")
((and (listp elt)
(markerp (car elt))
(integerp (cdr elt))) "m")
((null elt) "/")
(t "?")))
(defun undo-list-to-string (lst)
"Convert an undo list to a string.
See the Emacs LISP manual for the patterns matched. \"-\" means no undo
information is being stored, a parenthesized string means undo information,
and \"?\" means anything else. See `undo-elt-to-string' for the meanings
of the characters inside the parentheses."
(cond
((eq lst t) "-")
((listp lst) (concat "("
(mapconcat 'undo-elt-to-string lst "")
")"))
(t "?")))
(defun view-undo ()
"View the buffer undo information.
\"-\" means no undo information is being stored.
\"(...)\" means undo information is being stored, and the characters
in \"...\" (if any) describe the information. The newest information
comes on the left. Each character describes what was done (not how to
undo it).
\"i\" means an insertion.
\"d\" means a deletion.
\"*\" means a buffer modification or an update of the time.
\"p\" means a property change.
\"m\" means a marker motion.
\"/\" means a command boundary.
\"?\" means anything else.
\"?\" means anything else."
(interactive)
(message (undo-list-to-string buffer-undo-list)))
(global-set-key [f11] 'view-undo)