Function: evil-undo-pop
evil-undo-pop is a byte-compiled function defined in evil-common.el.
Signature
(evil-undo-pop)
Documentation
Undo and forget the last buffer change.
If undo is disabled in the current buffer, use the information
in evil-temporary-undo instead.
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-undo-pop ()
"Undo and forget the last buffer change.
If undo is disabled in the current buffer, use the information
in `evil-temporary-undo' instead."
(if (and (eq evil-undo-system 'undo-tree)
(not (eq buffer-undo-list t)))
(let (current)
(undo-tree-undo)
(setq current (undo-tree-current buffer-undo-tree)
current (nth (undo-tree-node-branch current)
(undo-tree-node-next current)))
;; Remove only if leaf to not have to adjust child buffer positions
(unless (undo-tree-node-next current) (undo-tree-snip-node current)))
(let ((paste-undo (list nil))
(undo-list (if (eq buffer-undo-list t)
evil-temporary-undo
buffer-undo-list)))
(when (or (not undo-list) (car undo-list))
(user-error "Can't undo previous change"))
(while (and undo-list (null (car undo-list)))
(pop undo-list)) ; remove nil
(while (and undo-list (car undo-list))
(push (pop undo-list) paste-undo))
(let ((buffer-undo-list (nreverse paste-undo)))
(evil-save-echo-area
(undo)))
(if (eq buffer-undo-list t)
(setq evil-temporary-undo nil)
(setq buffer-undo-list undo-list)))))