From 4224caf8571da124f7b9a45e7560ef56e5626bc3 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 5 May 2006 23:37:37 +0000 Subject: [PATCH] (kmacro-push-ring): Use add-to-history. (kmacro-ring-length): Remove unused defun. (kmacro-start-macro): Use kmacro-push-ring. --- lisp/kmacro.el | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 4566d4c32c3..e54b65ddb34 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -349,10 +349,7 @@ and `kmacro-counter-format'.") (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) @@ -377,11 +374,6 @@ Non-nil arg RAW means just return raw first element." (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." @@ -577,13 +569,8 @@ Use \\[kmacro-bind-to-key] to bind it to a key sequence." (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) -- 2.39.2