changeset 59438:7e26bfe14017

(calc-reset): Restore saved values of variables instead of default values (restore default values with a 0 argument).
author Jay Belanger <jay.p.belanger@gmail.com>
date Sun, 09 Jan 2005 15:55:08 +0000
parents 4cd1791518c2
children 6db9f450786b
files lisp/calc/calc-ext.el
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-ext.el	Sun Jan 09 15:48:20 2005 +0000
+++ b/lisp/calc/calc-ext.el	Sun Jan 09 15:55:08 2005 +0000
@@ -1240,20 +1240,22 @@
 
 (defun calc-reset (arg)
   (interactive "P")
+  (setq arg (if arg (prefix-numeric-value arg) nil))
   (save-excursion
     (or (eq major-mode 'calc-mode)
 	(calc-create-buffer))
     (if calc-embedded-info
 	(calc-embedded nil))
-    (or arg
-	(setq calc-stack nil))
+    (unless (and arg (> (abs arg) 0))
+      (setq calc-stack nil))
     (setq calc-undo-list nil
 	  calc-redo-list nil)
     (let (calc-stack calc-user-parse-tables calc-standard-date-formats
 		     calc-invocation-macro)
       (mapcar (function (lambda (v) (set v nil))) calc-local-var-list)
-      (mapcar (function (lambda (v) (set (car v) (nth 1 v))))
-	      calc-mode-var-list))
+      (if (and arg (<= arg 0))
+          (calc-mode-var-list-restore-default-values)
+        (calc-mode-var-list-restore-saved-values)))
     (calc-set-language nil nil t)
     (calc-mode)
     (calc-flush-caches t)