Commit b159e5b0 authored by Jay Belanger's avatar Jay Belanger
Browse files

(calc-undo-length): New variable.

(calc-quit): Truncate rather than eliminate `calc-undo-list'.
parent bd8aaa36
......@@ -417,6 +417,12 @@ in normal mode."
:group 'calc
:type 'boolean)
(defcustom calc-undo-length
"The number of undo steps that will be preserved when Calc is quit."
:group 'calc
:type 'integer)
(defvar calc-bug-address ""
"Address of the maintainer of Calc, for use by `report-calc-bug'.")
......@@ -1485,7 +1491,14 @@ commands given here will actually operate on the *Calculator* stack."
(unless (eq major-mode 'calc-mode)
(run-hooks 'calc-end-hook)
(setq calc-undo-list nil calc-redo-list nil)
(if (integerp calc-undo-length)
((= calc-undo-length 0)
(setq calc-undo-list nil calc-redo-list nil))
((> calc-undo-length 0)
(let ((tail (nthcdr (1- calc-undo-length) calc-undo-list)))
(if tail (setcdr tail nil)))
(setq calc-redo-list nil))))
(mapc (function (lambda (v) (set-default v (symbol-value v))))
(let ((buf (current-buffer))
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