1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

Remove unnecessary eval-when-compile.

(calc-do-quick-calc, calc-do-calc-eval, calc-alg-entry)
(math-read-expr-level, calc-check-user-syntax, math-read-factor):
Replace calls to calc-extensions by appropriate require,
replace calc-extensions-loaded by appropriate featurep.
This commit is contained in:
Jay Belanger 2004-11-29 05:56:06 +00:00
parent 6697b53cd3
commit 5eb3eedabb

View File

@ -27,10 +27,9 @@
;;; Code:
;; This file is autoloaded from calc.el.
(require 'calc)
(require 'calc)
(require 'calc-macs)
(eval-when-compile '(require calc-macs))
(defun calc-Need-calc-aent () nil)
@ -51,20 +50,20 @@
(entry (calc-do-alg-entry "" "Quick calc: " t))
(alg-exp (mapcar (function
(lambda (x)
(if (and (not calc-extensions-loaded)
(if (and (not (featurep 'calc-ext))
calc-previous-alg-entry
(string-match
"\\`[-0-9._+*/^() ]+\\'"
calc-previous-alg-entry))
(calc-normalize x)
(calc-extensions)
(require 'calc-ext)
(math-evaluate-expr x))))
entry)))
(when (and (= (length alg-exp) 1)
(eq (car-safe (car alg-exp)) 'calcFunc-assign)
(= (length (car alg-exp)) 3)
(eq (car-safe (nth 1 (car alg-exp))) 'var))
(calc-extensions)
(require 'calc-ext)
(set (nth 2 (nth 1 (car alg-exp))) (nth 2 (car alg-exp)))
(calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))
(setq alg-exp (list (nth 2 (car alg-exp)))))
@ -91,7 +90,7 @@
"")
")")))
(if (and (< (length buf) (frame-width)) (= (length entry) 1)
calc-extensions-loaded)
(featurep 'calc-ext))
(let ((long (concat (math-format-value (car entry) 1000)
" => " buf)))
(if (<= (length long) (- (frame-width) 8))
@ -147,7 +146,7 @@
((eq separator 'eval)
(eval str))
((eq separator 'macro)
(calc-extensions)
(require 'calc-ext)
(let* ((calc-buffer (current-buffer))
(calc-window (get-buffer-window calc-buffer))
(save-window (selected-window)))
@ -208,7 +207,7 @@
(and (memq 'clear-message calc-command-flags)
(message ""))
(cond ((eq separator 'pred)
(calc-extensions)
(require 'calc-ext)
(if (= (length res) 1)
(math-is-true (car res))
(calc-eval-error '(0 "Single value expected"))))
@ -276,19 +275,19 @@ T means abort and give an error message.")
(alg-exp (calc-do-alg-entry initial prompt t)))
(if (stringp alg-exp)
(progn
(calc-extensions)
(require 'calc-ext)
(calc-alg-edit alg-exp))
(let* ((calc-simplify-mode (if (eq last-command-char ?\C-j)
'none
calc-simplify-mode))
(nvals (mapcar 'calc-normalize alg-exp)))
(while alg-exp
(calc-record (if calc-extensions-loaded (car alg-exp) (car nvals))
(calc-record (if (featurep 'calc-ext) (car alg-exp) (car nvals))
"alg'")
(calc-pop-push-record-list calc-dollar-used
(and (not (equal (car alg-exp)
(car nvals)))
calc-extensions-loaded
(featurep 'calc-ext)
"")
(list (car nvals)))
(setq alg-exp (cdr alg-exp)
@ -786,7 +785,7 @@ T means abort and give an error message.")
(if (not (equal (car op) "2x"))
(math-read-token))
(and (memq (nth 1 op) '(sdev mod))
(calc-extensions))
(require 'calc-ext))
(setq x (cond ((consp (nth 1 op))
(funcall (car (nth 1 op)) x op))
((eq (nth 3 op) -1)
@ -802,7 +801,7 @@ T means abort and give an error message.")
((and (not first)
(memq (nth 1 op) math-alg-inequalities)
(memq (car-safe x) math-alg-inequalities))
(calc-extensions)
(require 'calc-ext)
(math-composite-inequalities x op))
(t (list (nth 1 op)
x
@ -830,7 +829,7 @@ T means abort and give an error message.")
(or (not (listp
(setq matches (calc-match-user-syntax rule))))
(let ((args (progn
(calc-extensions)
(require 'calc-ext)
calc-arg-values))
(conds nil)
temp)
@ -845,7 +844,7 @@ T means abort and give an error message.")
conds)
match (nth 1 match)))
(while (and conds match)
(calc-extensions)
(require 'calc-ext)
(cond ((eq (car-safe (car conds))
'calcFunc-let)
(setq temp (car conds))
@ -1037,7 +1036,7 @@ T means abort and give an error message.")
(throw 'syntax "Expected `)'"))
(math-read-token)
(if (and (eq calc-language 'fortran) args
(calc-extensions)
(require 'calc-ext)
(let ((calc-matrix-mode 'scalar))
(math-known-matrixp
(list 'var sym
@ -1096,7 +1095,7 @@ T means abort and give an error message.")
((eq math-exp-token 'hash)
(or calc-hashes-used
(throw 'syntax "#'s not allowed in this context"))
(calc-extensions)
(require 'calc-ext)
(if (<= math-expr-data (length calc-arg-values))
(let ((num math-expr-data))
(math-read-token)
@ -1127,7 +1126,7 @@ T means abort and give an error message.")
(setq exp (if (and exp2 (Math-realp exp)
(Math-anglep exp2))
(math-normalize (list 'polar exp exp2))
(calc-extensions)
(require 'calc-ext)
(list '* exp
(list 'calcFunc-exp
(list '*
@ -1154,16 +1153,16 @@ T means abort and give an error message.")
(math-read-token)
exp))
((eq math-exp-token 'string)
(calc-extensions)
(require 'calc-ext)
(math-read-string))
((equal math-expr-data "[")
(calc-extensions)
(require 'calc-ext)
(math-read-brackets t "]"))
((equal math-expr-data "{")
(calc-extensions)
(require 'calc-ext)
(math-read-brackets nil "}"))
((equal math-expr-data "<")
(calc-extensions)
(require 'calc-ext)
(math-read-angle-brackets))
(t (throw 'syntax "Expected a number")))))