comparison lisp/calc/calc.el @ 104010:671cf7805a1e

(calc-undo-length): New variable. (calc-quit): Truncate rather than eliminate `calc-undo-list'.
author Jay Belanger <jay.p.belanger@gmail.com>
date Tue, 21 Jul 2009 18:56:35 +0000
parents 70bd50ad24da
children 2afab32ae92d
comparison
equal deleted inserted replaced
104009:d66fb2315dc0 104010:671cf7805a1e
415 "If non-nil, multiplication has precedence over division 415 "If non-nil, multiplication has precedence over division
416 in normal mode." 416 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
423 (defvar calc-scan-for-dels t 429 (defvar calc-scan-for-dels t
424 "If t, scan keymaps to find all DEL-like keys. 430 "If t, scan keymaps to find all DEL-like keys.
1483 (eq (current-buffer) (aref calc-embedded-info 0))) 1489 (eq (current-buffer) (aref calc-embedded-info 0)))
1484 (calc-embedded nil) 1490 (calc-embedded nil)
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))
1492 (win (get-buffer-window (current-buffer))) 1505 (win (get-buffer-window (current-buffer)))
1493 (kbuf (get-buffer "*Calc Keypad*"))) 1506 (kbuf (get-buffer "*Calc Keypad*")))