(defun kmacro-push-ring (&optional elt)
"Push ELT or current macro onto `kmacro-ring'."
(when (setq elt (or elt (kmacro-ring-head)))
- (let ((len (length kmacro-ring)))
- (setq kmacro-ring (cons elt kmacro-ring))
- (if (>= len kmacro-ring-max)
- (setcdr (nthcdr len kmacro-ring) nil)))))
+ (add-to-history 'kmacro-ring elt kmacro-ring-max t)))
(defun kmacro-split-ring-element (elt)
(kmacro-pop-ring1 raw)))
-(defun kmacro-ring-length ()
- "Return length of macro ring, including pseudo head."
- (+ (if last-kbd-macro 1 0) (length kmacro-ring)))
-
-
(defun kmacro-ring-empty-p (&optional none)
"Tell user and return t if `last-kbd-macro' is nil or `kmacro-ring' is empty.
Check only `last-kbd-macro' if optional arg NONE is non-nil."
(let ((append (and arg (listp arg))))
(unless append
(if last-kbd-macro
- (let ((len (length kmacro-ring)))
- (setq kmacro-ring
- (cons
- (list last-kbd-macro kmacro-counter kmacro-counter-format-start)
- kmacro-ring))
- (if (>= len kmacro-ring-max)
- (setcdr (nthcdr len kmacro-ring) nil))))
+ (kmacro-push-ring
+ (list last-kbd-macro kmacro-counter kmacro-counter-format-start)))
(setq kmacro-counter (or (if arg (prefix-numeric-value arg))
kmacro-initial-counter-value
0)