Commit 4224caf8 authored by Kim F. Storm's avatar Kim F. Storm
Browse files

(kmacro-push-ring): Use add-to-history.

(kmacro-ring-length): Remove unused defun.
(kmacro-start-macro): Use kmacro-push-ring.
parent 77e5aef9
......@@ -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
(list last-kbd-macro kmacro-counter kmacro-counter-format-start)
(if (>= len kmacro-ring-max)
(setcdr (nthcdr len kmacro-ring) nil))))
(list last-kbd-macro kmacro-counter kmacro-counter-format-start)))
(setq kmacro-counter (or (if arg (prefix-numeric-value arg))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment