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