Function: vundo--mod-list-from
vundo--mod-list-from is a natively compiled function defined in
vundo.el.
Signature
(vundo--mod-list-from UNDO-LIST &optional N MOD-LIST)
Documentation
Generate and return a modification list from UNDO-LIST.
If N non-nil, only look at the first N entries in UNDO-LIST. If MOD-LIST non-nil, extend on MOD-LIST.
Source Code
;; Defined in /nix/store/386w2ds6bdh3gcz9k23jssw4cni4lfr2-emacs-packages-deps/share/emacs/site-lisp/elpa/vundo-2.4.0/vundo.el
(defun vundo--mod-list-from (undo-list &optional n mod-list)
"Generate and return a modification list from UNDO-LIST.
If N non-nil, only look at the first N entries in UNDO-LIST.
If MOD-LIST non-nil, extend on MOD-LIST."
(let ((uidx 0)
(mod-list (or mod-list (vector (make-vundo-m))))
new-mlist)
(while (and undo-list (or (null n) (< uidx n)))
;; Skip leading nils.
(while (and undo-list (null (car undo-list)))
(setq undo-list (cdr undo-list))
(cl-incf uidx))
;; It's possible the index was exceeded stepping over nil.
(when (or (null n) (< uidx n))
;; Add modification.
(let ((pos-only (vundo--position-only-p undo-list))
(mod-timestamp nil))
(unless pos-only
;; If this record is position-only, we skip it and don’t
;; add a mod for it. Effectively taking it out of the undo
;; tree. Read ‘Position-only records’ section in
;; Commentary for more explanation.
(cl-assert (not (null (car undo-list))))
(push (make-vundo-m :undo-list undo-list)
new-mlist))
;; Skip through the content of this modification.
(while (car undo-list)
;; Is this entry a timestamp?
(when (and (consp (car undo-list)) (eq (caar undo-list) t))
(setq mod-timestamp (cdar undo-list)))
(setq undo-list (cdr undo-list))
(cl-incf uidx))
;; If this modification contains a timestamp, the previous
;; state is saved to file.
(when (and mod-timestamp (not pos-only))
(setf (vundo-m-timestamp (car new-mlist)) mod-timestamp)))))
;; Convert to vector.
(vconcat mod-list new-mlist)))