changeset 62392:0476ffde9ab3

(calc-copy-special-constant): New function.
author Jay Belanger <jay.p.belanger@gmail.com>
date Mon, 16 May 2005 03:55:11 +0000
parents 65d4d337ea31
children 73a2645459f6
files lisp/calc/calc-store.el
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-store.el	Mon May 16 03:54:05 2005 +0000
+++ b/lisp/calc/calc-store.el	Mon May 16 03:55:11 2005 +0000
@@ -387,6 +387,26 @@
   (interactive)
   (calc-recall (intern (format "var-q%c" last-command-char))))
 
+(defun calc-copy-special-constant (&optional sconst var)
+  (interactive)
+  (let ((sc '(("")
+              ("e" . (special-const (math-e)))
+              ("pi" . (special-const (math-pi)))
+              ("i" . (special-const (math-imaginary 1)))
+              ("phi" . (special-const (math-phi)))
+              ("gamma" . (special-const (math-gamma-const))))))
+  (calc-wrapper
+   (or sconst (setq sconst (completing-read "Special constant: " sc nil t)))
+   (unless (string= sconst "")
+     (let ((value (cdr (assoc sconst sc))))
+       (or var (setq var (calc-read-var-name
+                            (format "Copy special constant %s, to: " 
+                                    sconst))))
+       (if var
+           (let ((msg (calc-store-value var value "")))
+             (message (concat "Special constant \"%s\" copied to \"%s\"" msg)
+                      sconst (calc-var-name var)))))))))
+
 (defun calc-copy-variable (&optional var1 var2)
   (interactive)
   (calc-wrapper