aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2009-07-21 18:56:35 +0000
committerJay Belanger2009-07-21 18:56:35 +0000
commitb159e5b04752be4702b1f0da6565c4837d711757 (patch)
treee6df403ee5f9d78d05d14a0da613f13528a7aec8
parentbd8aaa36dad1df7ceef05258e2ac5b6561b6587a (diff)
downloademacs-b159e5b04752be4702b1f0da6565c4837d711757.tar.gz
emacs-b159e5b04752be4702b1f0da6565c4837d711757.zip
(calc-undo-length): New variable.
(calc-quit): Truncate rather than eliminate `calc-undo-list'.
-rw-r--r--lisp/calc/calc.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 78513c891f6..704209d7680 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -417,6 +417,12 @@ in normal mode."
417 :group 'calc 417 :group 'calc
418 :type 'boolean) 418 :type 'boolean)
419 419
420(defcustom calc-undo-length
421 100
422 "The number of undo steps that will be preserved when Calc is quit."
423 :group 'calc
424 :type 'integer)
425
420(defvar calc-bug-address "jay.p.belanger@gmail.com" 426(defvar calc-bug-address "jay.p.belanger@gmail.com"
421 "Address of the maintainer of Calc, for use by `report-calc-bug'.") 427 "Address of the maintainer of Calc, for use by `report-calc-bug'.")
422 428
@@ -1485,7 +1491,14 @@ commands given here will actually operate on the *Calculator* stack."
1485 (unless (eq major-mode 'calc-mode) 1491 (unless (eq major-mode 'calc-mode)
1486 (calc-create-buffer)) 1492 (calc-create-buffer))
1487 (run-hooks 'calc-end-hook) 1493 (run-hooks 'calc-end-hook)
1488 (setq calc-undo-list nil calc-redo-list nil) 1494 (if (integerp calc-undo-length)
1495 (cond
1496 ((= calc-undo-length 0)
1497 (setq calc-undo-list nil calc-redo-list nil))
1498 ((> calc-undo-length 0)
1499 (let ((tail (nthcdr (1- calc-undo-length) calc-undo-list)))
1500 (if tail (setcdr tail nil)))
1501 (setq calc-redo-list nil))))
1489 (mapc (function (lambda (v) (set-default v (symbol-value v)))) 1502 (mapc (function (lambda (v) (set-default v (symbol-value v))))
1490 calc-local-var-list) 1503 calc-local-var-list)
1491 (let ((buf (current-buffer)) 1504 (let ((buf (current-buffer))