diff options
| author | Jay Belanger | 2004-11-29 06:00:07 +0000 |
|---|---|---|
| committer | Jay Belanger | 2004-11-29 06:00:07 +0000 |
| commit | ce805efac061905e51f49f87c8d75a7c67d82282 (patch) | |
| tree | 2b02ebdac3052594e6cc4ad319a67d7a979358b0 | |
| parent | 537a762d4b093cd58c296cab2b166d8b39fe1699 (diff) | |
| download | emacs-ce805efac061905e51f49f87c8d75a7c67d82282.tar.gz emacs-ce805efac061905e51f49f87c8d75a7c67d82282.zip | |
Move require to end of file.
(calc-info-filename, calc-autoload-directory, calc-extensions-loaded):
Remove unnecessary variable.
(calc-do-dispatch, calc-mode, calc-check-defines, calc-create-buffer)
(calc, calc-keypad, full-calc-keypad, calc-do, calc-normalize)
(calc-binary-op, calc-unary-op, calcDigit-start, calcDigit-key)
(math-normalize, math-add, math-mul, math-div,
(math-format-stack-value, math-stack-value-offset, math-format-value)
(math-format-flat-expr, math-format-number, math-format-bignum)
(math-read-number, calc-grab-region, calc-grab-rectangle)
(calc-grab-sum-down, calc-grab-sum-across, calc-embedded, defmath)
(calc-check-defines): Replace calc-need-macros by appropriate require.
| -rw-r--r-- | lisp/calc/calc.el | 135 |
1 files changed, 55 insertions, 80 deletions
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index d2b75a2a24a..a06f355c7e6 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el | |||
| @@ -203,28 +203,13 @@ | |||
| 203 | 203 | ||
| 204 | ;;; Code: | 204 | ;;; Code: |
| 205 | 205 | ||
| 206 | (provide 'calc) | ||
| 207 | (require 'calc-macs) | 206 | (require 'calc-macs) |
| 208 | 207 | ||
| 209 | ;;; The "###autoload" comment will be used by Emacs version 19 for | ||
| 210 | ;;; maintaining the loaddefs.el file automatically. | ||
| 211 | |||
| 212 | ;;;###autoload | ||
| 213 | (defvar calc-info-filename "calc.info" | ||
| 214 | "*File name in which to look for the Calculator's Info documentation.") | ||
| 215 | |||
| 216 | ;;;###autoload | 208 | ;;;###autoload |
| 217 | (defvar calc-settings-file user-init-file | 209 | (defvar calc-settings-file user-init-file |
| 218 | "*File in which to record permanent settings; default is `user-init-file'.") | 210 | "*File in which to record permanent settings; default is `user-init-file'.") |
| 219 | 211 | ||
| 220 | ;;;###autoload | 212 | ;;;###autoload |
| 221 | (defvar calc-autoload-directory nil | ||
| 222 | "Name of directory from which additional \".elc\" files for Calc should be | ||
| 223 | loaded. Should include a trailing \"/\". | ||
| 224 | If nil, use original installation directory. | ||
| 225 | This can safely be nil as long as the Calc files are on the load-path.") | ||
| 226 | |||
| 227 | ;;;###autoload | ||
| 228 | (defvar calc-gnuplot-name "gnuplot" | 213 | (defvar calc-gnuplot-name "gnuplot" |
| 229 | "*Name of GNUPLOT program, for calc-graph features.") | 214 | "*Name of GNUPLOT program, for calc-graph features.") |
| 230 | 215 | ||
| @@ -243,8 +228,6 @@ This can safely be nil as long as the Calc files are on the load-path.") | |||
| 243 | "If t, scan keymaps to find all DEL-like keys. | 228 | "If t, scan keymaps to find all DEL-like keys. |
| 244 | if nil, only DEL itself is mapped to calc-pop.") | 229 | if nil, only DEL itself is mapped to calc-pop.") |
| 245 | 230 | ||
| 246 | (defvar calc-extensions-loaded nil) | ||
| 247 | |||
| 248 | (defvar calc-stack '((top-of-stack 1 nil)) | 231 | (defvar calc-stack '((top-of-stack 1 nil)) |
| 249 | "Calculator stack. | 232 | "Calculator stack. |
| 250 | Entries are 3-lists: Formula, Height (in lines), Selection (or nil).") | 233 | Entries are 3-lists: Formula, Height (in lines), Selection (or nil).") |
| @@ -702,14 +685,7 @@ If nil, selections displayed but ignored.") | |||
| 702 | (directory-file-name | 685 | (directory-file-name |
| 703 | (file-name-directory | 686 | (file-name-directory |
| 704 | (expand-file-name | 687 | (expand-file-name |
| 705 | name (car p2)))))))))) | 688 | name (car p2)))))))))))) |
| 706 | |||
| 707 | ;; If calc-autoload-directory is given, use that (and hope it works!). | ||
| 708 | (and calc-autoload-directory | ||
| 709 | (not (equal calc-autoload-directory "")) | ||
| 710 | (setq load-path (nconc load-path | ||
| 711 | (list (directory-file-name | ||
| 712 | calc-autoload-directory))))))) | ||
| 713 | 689 | ||
| 714 | ;; The following modes use specially-formatted data. | 690 | ;; The following modes use specially-formatted data. |
| 715 | (put 'calc-mode 'mode-class 'special) | 691 | (put 'calc-mode 'mode-class 'special) |
| @@ -917,9 +893,6 @@ If nil, selections displayed but ignored.") | |||
| 917 | ( ?? . calc-dispatch-help ) )) | 893 | ( ?? . calc-dispatch-help ) )) |
| 918 | map)) | 894 | map)) |
| 919 | 895 | ||
| 920 | (autoload 'calc-extensions "calc-ext") | ||
| 921 | (autoload 'calc-need-macros "calc-macs") | ||
| 922 | |||
| 923 | ;;;; (Autoloads here) | 896 | ;;;; (Autoloads here) |
| 924 | (mapcar | 897 | (mapcar |
| 925 | (lambda (x) (dolist (func (cdr x)) (autoload func (car x)))) | 898 | (lambda (x) (dolist (func (cdr x)) (autoload func (car x)))) |
| @@ -989,7 +962,7 @@ If nil, selections displayed but ignored.") | |||
| 989 | (message "") | 962 | (message "") |
| 990 | (if key | 963 | (if key |
| 991 | (progn | 964 | (progn |
| 992 | (or (commandp key) (calc-extensions)) | 965 | (or (commandp key) (require 'calc-ext)) |
| 993 | (call-interactively key)) | 966 | (call-interactively key)) |
| 994 | (beep)))) | 967 | (beep)))) |
| 995 | 968 | ||
| @@ -1048,7 +1021,7 @@ Notations: 3.14e6 3.14 * 10^6 | |||
| 1048 | (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list) | 1021 | (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list) |
| 1049 | (kill-all-local-variables) | 1022 | (kill-all-local-variables) |
| 1050 | (use-local-map (if (eq calc-algebraic-mode 'total) | 1023 | (use-local-map (if (eq calc-algebraic-mode 'total) |
| 1051 | (progn (calc-extensions) calc-alg-map) calc-mode-map)) | 1024 | (progn (require 'calc-ext) calc-alg-map) calc-mode-map)) |
| 1052 | (mapcar (function (lambda (v) (make-local-variable v))) calc-local-var-list) | 1025 | (mapcar (function (lambda (v) (make-local-variable v))) calc-local-var-list) |
| 1053 | (make-local-variable 'overlay-arrow-position) | 1026 | (make-local-variable 'overlay-arrow-position) |
| 1054 | (make-local-variable 'overlay-arrow-string) | 1027 | (make-local-variable 'overlay-arrow-string) |
| @@ -1088,8 +1061,8 @@ Notations: 3.14e6 3.14 * 10^6 | |||
| 1088 | (setq plist (cdr (cdr plist)))) | 1061 | (setq plist (cdr (cdr plist)))) |
| 1089 | (if plist | 1062 | (if plist |
| 1090 | (save-excursion | 1063 | (save-excursion |
| 1091 | (calc-extensions) | 1064 | (require 'calc-ext) |
| 1092 | (calc-need-macros) | 1065 | (require 'calc-macs) |
| 1093 | (set-buffer "*Calculator*") | 1066 | (set-buffer "*Calculator*") |
| 1094 | (while plist | 1067 | (while plist |
| 1095 | (put 'calc-define (car plist) nil) | 1068 | (put 'calc-define (car plist) nil) |
| @@ -1135,9 +1108,9 @@ commands given here will actually operate on the *Calculator* stack." | |||
| 1135 | (calc-mode)) | 1108 | (calc-mode)) |
| 1136 | (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000)) | 1109 | (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000)) |
| 1137 | (when calc-always-load-extensions | 1110 | (when calc-always-load-extensions |
| 1138 | (calc-extensions)) | 1111 | (require 'calc-ext)) |
| 1139 | (when calc-language | 1112 | (when calc-language |
| 1140 | (calc-extensions) | 1113 | (require 'calc-ext) |
| 1141 | (calc-set-language calc-language calc-language-option t))) | 1114 | (calc-set-language calc-language calc-language-option t))) |
| 1142 | 1115 | ||
| 1143 | ;;;###autoload | 1116 | ;;;###autoload |
| @@ -1146,7 +1119,7 @@ commands given here will actually operate on the *Calculator* stack." | |||
| 1146 | (interactive "P\ni\np") | 1119 | (interactive "P\ni\np") |
| 1147 | (if arg | 1120 | (if arg |
| 1148 | (unless (eq arg 0) | 1121 | (unless (eq arg 0) |
| 1149 | (calc-extensions) | 1122 | (require 'calc-ext) |
| 1150 | (if (= (prefix-numeric-value arg) -1) | 1123 | (if (= (prefix-numeric-value arg) -1) |
| 1151 | (calc-grab-region (region-beginning) (region-end) nil) | 1124 | (calc-grab-region (region-beginning) (region-end) nil) |
| 1152 | (when (= (prefix-numeric-value arg) -2) | 1125 | (when (= (prefix-numeric-value arg) -2) |
| @@ -1270,7 +1243,7 @@ This is most useful in the X window system. | |||
| 1270 | In this mode, click on the Calc \"buttons\" using the left mouse button. | 1243 | In this mode, click on the Calc \"buttons\" using the left mouse button. |
| 1271 | Or, position the cursor manually and do M-x calc-keypad-press." | 1244 | Or, position the cursor manually and do M-x calc-keypad-press." |
| 1272 | (interactive "p") | 1245 | (interactive "p") |
| 1273 | (calc-extensions) | 1246 | (require 'calc-ext) |
| 1274 | (calc-do-keypad calc-full-mode interactive)) | 1247 | (calc-do-keypad calc-full-mode interactive)) |
| 1275 | 1248 | ||
| 1276 | ;;;###autoload | 1249 | ;;;###autoload |
| @@ -1278,7 +1251,7 @@ Or, position the cursor manually and do M-x calc-keypad-press." | |||
| 1278 | "Invoke the Calculator in full-screen \"visual keypad\" mode. | 1251 | "Invoke the Calculator in full-screen \"visual keypad\" mode. |
| 1279 | See calc-keypad for details." | 1252 | See calc-keypad for details." |
| 1280 | (interactive "p") | 1253 | (interactive "p") |
| 1281 | (calc-extensions) | 1254 | (require 'calc-ext) |
| 1282 | (calc-do-keypad t interactive)) | 1255 | (calc-do-keypad t interactive)) |
| 1283 | 1256 | ||
| 1284 | 1257 | ||
| @@ -1292,7 +1265,7 @@ See calc-keypad for details." | |||
| 1292 | (calc-check-defines) | 1265 | (calc-check-defines) |
| 1293 | (let* ((calc-command-flags nil) | 1266 | (let* ((calc-command-flags nil) |
| 1294 | (calc-start-time (and calc-timing (not calc-start-time) | 1267 | (calc-start-time (and calc-timing (not calc-start-time) |
| 1295 | (calc-extensions) | 1268 | (require 'calc-ext) |
| 1296 | (current-time-string))) | 1269 | (current-time-string))) |
| 1297 | (gc-cons-threshold (max gc-cons-threshold | 1270 | (gc-cons-threshold (max gc-cons-threshold |
| 1298 | (if calc-timing 2000000 100000))) | 1271 | (if calc-timing 2000000 100000))) |
| @@ -1305,7 +1278,7 @@ See calc-keypad for details." | |||
| 1305 | (calc-embedded-select-buffer) | 1278 | (calc-embedded-select-buffer) |
| 1306 | (calc-select-buffer)) | 1279 | (calc-select-buffer)) |
| 1307 | (and (eq calc-algebraic-mode 'total) | 1280 | (and (eq calc-algebraic-mode 'total) |
| 1308 | (calc-extensions) | 1281 | (require 'calc-ext) |
| 1309 | (use-local-map calc-alg-map)) | 1282 | (use-local-map calc-alg-map)) |
| 1310 | (when (and do-slow calc-display-working-message) | 1283 | (when (and do-slow calc-display-working-message) |
| 1311 | (message "Working...") | 1284 | (message "Working...") |
| @@ -1580,7 +1553,7 @@ See calc-keypad for details." | |||
| 1580 | (defun calc-normalize (val) | 1553 | (defun calc-normalize (val) |
| 1581 | (if (memq calc-simplify-mode '(nil none num)) | 1554 | (if (memq calc-simplify-mode '(nil none num)) |
| 1582 | (math-normalize val) | 1555 | (math-normalize val) |
| 1583 | (calc-extensions) | 1556 | (require 'calc-ext) |
| 1584 | (calc-normalize-fancy val))) | 1557 | (calc-normalize-fancy val))) |
| 1585 | 1558 | ||
| 1586 | (defun calc-handle-whys () | 1559 | (defun calc-handle-whys () |
| @@ -1860,7 +1833,7 @@ See calc-keypad for details." | |||
| 1860 | (calc-enter-result 2 name (cons (or func2 func) | 1833 | (calc-enter-result 2 name (cons (or func2 func) |
| 1861 | (mapcar 'math-check-complete | 1834 | (mapcar 'math-check-complete |
| 1862 | (calc-top-list 2)))) | 1835 | (calc-top-list 2)))) |
| 1863 | (calc-extensions) | 1836 | (require 'calc-ext) |
| 1864 | (calc-binary-op-fancy name func arg ident unary))) | 1837 | (calc-binary-op-fancy name func arg ident unary))) |
| 1865 | 1838 | ||
| 1866 | (defun calc-unary-op (name func arg &optional func2) | 1839 | (defun calc-unary-op (name func arg &optional func2) |
| @@ -1868,7 +1841,7 @@ See calc-keypad for details." | |||
| 1868 | (if (null arg) | 1841 | (if (null arg) |
| 1869 | (calc-enter-result 1 name (list (or func2 func) | 1842 | (calc-enter-result 1 name (list (or func2 func) |
| 1870 | (math-check-complete (calc-top 1)))) | 1843 | (math-check-complete (calc-top 1)))) |
| 1871 | (calc-extensions) | 1844 | (require 'calc-ext) |
| 1872 | (calc-unary-op-fancy name func arg))) | 1845 | (calc-unary-op-fancy name func arg))) |
| 1873 | 1846 | ||
| 1874 | 1847 | ||
| @@ -1980,7 +1953,7 @@ See calc-keypad for details." | |||
| 1980 | calc-digit-value)))))) | 1953 | calc-digit-value)))))) |
| 1981 | (if (eq calc-prev-char 'dots) | 1954 | (if (eq calc-prev-char 'dots) |
| 1982 | (progn | 1955 | (progn |
| 1983 | (calc-extensions) | 1956 | (require 'calc-ext) |
| 1984 | (calc-dots))))))) | 1957 | (calc-dots))))))) |
| 1985 | 1958 | ||
| 1986 | (defsubst calc-minibuffer-size () | 1959 | (defsubst calc-minibuffer-size () |
| @@ -2104,7 +2077,7 @@ See calc-keypad for details." | |||
| 2104 | (if (and (eq this-command last-command) | 2077 | (if (and (eq this-command last-command) |
| 2105 | (eq last-command-char ?.)) | 2078 | (eq last-command-char ?.)) |
| 2106 | (progn | 2079 | (progn |
| 2107 | (calc-extensions) | 2080 | (require 'calc-ext) |
| 2108 | (calc-digit-dots)) | 2081 | (calc-digit-dots)) |
| 2109 | (delete-backward-char 1) | 2082 | (delete-backward-char 1) |
| 2110 | (beep) | 2083 | (beep) |
| @@ -2279,11 +2252,11 @@ See calc-keypad for details." | |||
| 2279 | (integerp (car math-normalize-a)) | 2252 | (integerp (car math-normalize-a)) |
| 2280 | (and (consp (car math-normalize-a)) | 2253 | (and (consp (car math-normalize-a)) |
| 2281 | (not (eq (car (car math-normalize-a)) 'lambda)))) | 2254 | (not (eq (car (car math-normalize-a)) 'lambda)))) |
| 2282 | (calc-extensions) | 2255 | (require 'calc-ext) |
| 2283 | (math-normalize-fancy math-normalize-a)) | 2256 | (math-normalize-fancy math-normalize-a)) |
| 2284 | (t | 2257 | (t |
| 2285 | (or (and calc-simplify-mode | 2258 | (or (and calc-simplify-mode |
| 2286 | (calc-extensions) | 2259 | (require 'calc-ext) |
| 2287 | (math-normalize-nonstandard)) | 2260 | (math-normalize-nonstandard)) |
| 2288 | (let ((args (mapcar 'math-normalize (cdr math-normalize-a)))) | 2261 | (let ((args (mapcar 'math-normalize (cdr math-normalize-a)))) |
| 2289 | (or (condition-case err | 2262 | (or (condition-case err |
| @@ -2300,7 +2273,7 @@ See calc-keypad for details." | |||
| 2300 | (progn | 2273 | (progn |
| 2301 | (or (eq var-EvalRules math-eval-rules-cache-tag) | 2274 | (or (eq var-EvalRules math-eval-rules-cache-tag) |
| 2302 | (progn | 2275 | (progn |
| 2303 | (calc-extensions) | 2276 | (require 'calc-ext) |
| 2304 | (math-recompile-eval-rules))) | 2277 | (math-recompile-eval-rules))) |
| 2305 | (and (or math-eval-rules-cache-other | 2278 | (and (or math-eval-rules-cache-other |
| 2306 | (assq (car math-normalize-a) | 2279 | (assq (car math-normalize-a) |
| @@ -2313,8 +2286,8 @@ See calc-keypad for details." | |||
| 2313 | (apply (cdr func) args) | 2286 | (apply (cdr func) args) |
| 2314 | (and (or (consp (car math-normalize-a)) | 2287 | (and (or (consp (car math-normalize-a)) |
| 2315 | (fboundp (car math-normalize-a)) | 2288 | (fboundp (car math-normalize-a)) |
| 2316 | (and (not calc-extensions-loaded) | 2289 | (and (not (featurep 'calc-ext)) |
| 2317 | (calc-extensions) | 2290 | (require 'calc-ext) |
| 2318 | (fboundp (car math-normalize-a)))) | 2291 | (fboundp (car math-normalize-a)))) |
| 2319 | (apply (car math-normalize-a) args))))) | 2292 | (apply (car math-normalize-a) args))))) |
| 2320 | (wrong-number-of-arguments | 2293 | (wrong-number-of-arguments |
| @@ -2582,7 +2555,7 @@ See calc-keypad for details." | |||
| 2582 | (cons 'bigpos diff)))) | 2555 | (cons 'bigpos diff)))) |
| 2583 | (cons 'bigpos (math-add-bignum (cdr a) (cdr b))))))) | 2556 | (cons 'bigpos (math-add-bignum (cdr a) (cdr b))))))) |
| 2584 | (and (Math-ratp a) (Math-ratp b) | 2557 | (and (Math-ratp a) (Math-ratp b) |
| 2585 | (calc-extensions) | 2558 | (require 'calc-ext) |
| 2586 | (calc-add-fractions a b)) | 2559 | (calc-add-fractions a b)) |
| 2587 | (and (Math-realp a) (Math-realp b) | 2560 | (and (Math-realp a) (Math-realp b) |
| 2588 | (progn | 2561 | (progn |
| @@ -2591,9 +2564,9 @@ See calc-keypad for details." | |||
| 2591 | (or (and (consp b) (eq (car b) 'float)) | 2564 | (or (and (consp b) (eq (car b) 'float)) |
| 2592 | (setq b (math-float b))) | 2565 | (setq b (math-float b))) |
| 2593 | (math-add-float a b))) | 2566 | (math-add-float a b))) |
| 2594 | (and (calc-extensions) | 2567 | (and (require 'calc-ext) |
| 2595 | (math-add-objects-fancy a b)))) | 2568 | (math-add-objects-fancy a b)))) |
| 2596 | (and (calc-extensions) | 2569 | (and (require 'calc-ext) |
| 2597 | (math-add-symb-fancy a b)))) | 2570 | (math-add-symb-fancy a b)))) |
| 2598 | 2571 | ||
| 2599 | (defun math-add-bignum (a b) ; [L L L; l l l] | 2572 | (defun math-add-bignum (a b) ; [L L L; l l l] |
| @@ -2722,12 +2695,12 @@ See calc-keypad for details." | |||
| 2722 | (and (Math-zerop a) (not (eq (car-safe b) 'mod)) | 2695 | (and (Math-zerop a) (not (eq (car-safe b) 'mod)) |
| 2723 | (if (Math-scalarp b) | 2696 | (if (Math-scalarp b) |
| 2724 | (if (and (math-floatp b) (Math-ratp a)) (math-float a) a) | 2697 | (if (and (math-floatp b) (Math-ratp a)) (math-float a) a) |
| 2725 | (calc-extensions) | 2698 | (require 'calc-ext) |
| 2726 | (math-mul-zero a b))) | 2699 | (math-mul-zero a b))) |
| 2727 | (and (Math-zerop b) (not (eq (car-safe a) 'mod)) | 2700 | (and (Math-zerop b) (not (eq (car-safe a) 'mod)) |
| 2728 | (if (Math-scalarp a) | 2701 | (if (Math-scalarp a) |
| 2729 | (if (and (math-floatp a) (Math-ratp b)) (math-float b) b) | 2702 | (if (and (math-floatp a) (Math-ratp b)) (math-float b) b) |
| 2730 | (calc-extensions) | 2703 | (require 'calc-ext) |
| 2731 | (math-mul-zero b a))) | 2704 | (math-mul-zero b a))) |
| 2732 | (and (Math-objvecp a) (Math-objvecp b) | 2705 | (and (Math-objvecp a) (Math-objvecp b) |
| 2733 | (or | 2706 | (or |
| @@ -2743,7 +2716,7 @@ See calc-keypad for details." | |||
| 2743 | (math-mul-bignum-digit (cdr a) (nth 1 b) 0)) | 2716 | (math-mul-bignum-digit (cdr a) (nth 1 b) 0)) |
| 2744 | (math-mul-bignum-digit (cdr b) (nth 1 a) 0)))))) | 2717 | (math-mul-bignum-digit (cdr b) (nth 1 a) 0)))))) |
| 2745 | (and (Math-ratp a) (Math-ratp b) | 2718 | (and (Math-ratp a) (Math-ratp b) |
| 2746 | (calc-extensions) | 2719 | (require 'calc-ext) |
| 2747 | (calc-mul-fractions a b)) | 2720 | (calc-mul-fractions a b)) |
| 2748 | (and (Math-realp a) (Math-realp b) | 2721 | (and (Math-realp a) (Math-realp b) |
| 2749 | (progn | 2722 | (progn |
| @@ -2753,9 +2726,9 @@ See calc-keypad for details." | |||
| 2753 | (setq b (math-float b))) | 2726 | (setq b (math-float b))) |
| 2754 | (math-make-float (math-mul (nth 1 a) (nth 1 b)) | 2727 | (math-make-float (math-mul (nth 1 a) (nth 1 b)) |
| 2755 | (+ (nth 2 a) (nth 2 b))))) | 2728 | (+ (nth 2 a) (nth 2 b))))) |
| 2756 | (and (calc-extensions) | 2729 | (and (require 'calc-ext) |
| 2757 | (math-mul-objects-fancy a b)))) | 2730 | (math-mul-objects-fancy a b)))) |
| 2758 | (and (calc-extensions) | 2731 | (and (require 'calc-ext) |
| 2759 | (math-mul-symb-fancy a b)))) | 2732 | (math-mul-symb-fancy a b)))) |
| 2760 | 2733 | ||
| 2761 | (defun math-infinitep (a &optional undir) | 2734 | (defun math-infinitep (a &optional undir) |
| @@ -2911,12 +2884,12 @@ See calc-keypad for details." | |||
| 2911 | (defun math-div (a b) | 2884 | (defun math-div (a b) |
| 2912 | (or | 2885 | (or |
| 2913 | (and (Math-zerop b) | 2886 | (and (Math-zerop b) |
| 2914 | (calc-extensions) | 2887 | (require 'calc-ext) |
| 2915 | (math-div-by-zero a b)) | 2888 | (math-div-by-zero a b)) |
| 2916 | (and (Math-zerop a) (not (eq (car-safe b) 'mod)) | 2889 | (and (Math-zerop a) (not (eq (car-safe b) 'mod)) |
| 2917 | (if (Math-scalarp b) | 2890 | (if (Math-scalarp b) |
| 2918 | (if (and (math-floatp b) (Math-ratp a)) (math-float a) a) | 2891 | (if (and (math-floatp b) (Math-ratp a)) (math-float a) a) |
| 2919 | (calc-extensions) | 2892 | (require 'calc-ext) |
| 2920 | (math-div-zero a b))) | 2893 | (math-div-zero a b))) |
| 2921 | (and (Math-objvecp a) (Math-objvecp b) | 2894 | (and (Math-objvecp a) (Math-objvecp b) |
| 2922 | (or | 2895 | (or |
| @@ -2926,12 +2899,12 @@ See calc-keypad for details." | |||
| 2926 | (car q) | 2899 | (car q) |
| 2927 | (if calc-prefer-frac | 2900 | (if calc-prefer-frac |
| 2928 | (progn | 2901 | (progn |
| 2929 | (calc-extensions) | 2902 | (require 'calc-ext) |
| 2930 | (math-make-frac a b)) | 2903 | (math-make-frac a b)) |
| 2931 | (math-div-float (math-make-float a 0) | 2904 | (math-div-float (math-make-float a 0) |
| 2932 | (math-make-float b 0)))))) | 2905 | (math-make-float b 0)))))) |
| 2933 | (and (Math-ratp a) (Math-ratp b) | 2906 | (and (Math-ratp a) (Math-ratp b) |
| 2934 | (calc-extensions) | 2907 | (require 'calc-ext) |
| 2935 | (calc-div-fractions a b)) | 2908 | (calc-div-fractions a b)) |
| 2936 | (and (Math-realp a) (Math-realp b) | 2909 | (and (Math-realp a) (Math-realp b) |
| 2937 | (progn | 2910 | (progn |
| @@ -2940,9 +2913,9 @@ See calc-keypad for details." | |||
| 2940 | (or (and (consp b) (eq (car b) 'float)) | 2913 | (or (and (consp b) (eq (car b) 'float)) |
| 2941 | (setq b (math-float b))) | 2914 | (setq b (math-float b))) |
| 2942 | (math-div-float a b))) | 2915 | (math-div-float a b))) |
| 2943 | (and (calc-extensions) | 2916 | (and (require 'calc-ext) |
| 2944 | (math-div-objects-fancy a b)))) | 2917 | (math-div-objects-fancy a b)))) |
| 2945 | (and (calc-extensions) | 2918 | (and (require 'calc-ext) |
| 2946 | (math-div-symb-fancy a b)))) | 2919 | (math-div-symb-fancy a b)))) |
| 2947 | 2920 | ||
| 2948 | (defun math-div-float (a b) ; [F F F] | 2921 | (defun math-div-float (a b) ; [F F F] |
| @@ -2971,7 +2944,7 @@ See calc-keypad for details." | |||
| 2971 | (memq calc-language '(nil flat unform)) | 2944 | (memq calc-language '(nil flat unform)) |
| 2972 | (null math-comp-selected)) | 2945 | (null math-comp-selected)) |
| 2973 | (math-format-number a)) | 2946 | (math-format-number a)) |
| 2974 | (t (calc-extensions) | 2947 | (t (require 'calc-ext) |
| 2975 | (math-compose-expr a 0)))) | 2948 | (math-compose-expr a 0)))) |
| 2976 | (off (math-stack-value-offset c)) | 2949 | (off (math-stack-value-offset c)) |
| 2977 | s w) | 2950 | s w) |
| @@ -2994,7 +2967,7 @@ See calc-keypad for details." | |||
| 2994 | c))) | 2967 | c))) |
| 2995 | (unless (or (equal calc-right-label "") | 2968 | (unless (or (equal calc-right-label "") |
| 2996 | (eq a 'top-of-stack)) | 2969 | (eq a 'top-of-stack)) |
| 2997 | (calc-extensions) | 2970 | (require 'calc-ext) |
| 2998 | (setq c (list 'horiz c | 2971 | (setq c (list 'horiz c |
| 2999 | (make-string (max (- w (math-comp-width c) | 2972 | (make-string (max (- w (math-comp-width c) |
| 3000 | (length calc-right-label)) 0) ? ) | 2973 | (length calc-right-label)) 0) ? ) |
| @@ -3024,7 +2997,7 @@ See calc-keypad for details." | |||
| 3024 | math-svo-off) | 2997 | math-svo-off) |
| 3025 | (if calc-display-just | 2998 | (if calc-display-just |
| 3026 | (progn | 2999 | (progn |
| 3027 | (calc-extensions) | 3000 | (require 'calc-ext) |
| 3028 | (math-stack-value-offset-fancy)) | 3001 | (math-stack-value-offset-fancy)) |
| 3029 | (setq math-svo-off (or calc-display-origin 0)) | 3002 | (setq math-svo-off (or calc-display-origin 0)) |
| 3030 | (when (integerp calc-line-breaking) | 3003 | (when (integerp calc-line-breaking) |
| @@ -3044,7 +3017,7 @@ See calc-keypad for details." | |||
| 3044 | (if (and (Math-scalarp a) | 3017 | (if (and (Math-scalarp a) |
| 3045 | (memq calc-language '(nil flat unform))) | 3018 | (memq calc-language '(nil flat unform))) |
| 3046 | (math-format-number a) | 3019 | (math-format-number a) |
| 3047 | (calc-extensions) | 3020 | (require 'calc-ext) |
| 3048 | (let ((calc-line-breaking nil)) | 3021 | (let ((calc-line-breaking nil)) |
| 3049 | (math-composition-to-string (math-compose-expr a 0) w)))) | 3022 | (math-composition-to-string (math-compose-expr a 0) w)))) |
| 3050 | 3023 | ||
| @@ -3080,7 +3053,7 @@ See calc-keypad for details." | |||
| 3080 | (calc-language nil)) | 3053 | (calc-language nil)) |
| 3081 | (math-format-number a))) | 3054 | (math-format-number a))) |
| 3082 | (t | 3055 | (t |
| 3083 | (calc-extensions) | 3056 | (require 'calc-ext) |
| 3084 | (math-format-flat-expr-fancy a prec)))) | 3057 | (math-format-flat-expr-fancy a prec)))) |
| 3085 | 3058 | ||
| 3086 | 3059 | ||
| @@ -3090,7 +3063,7 @@ See calc-keypad for details." | |||
| 3090 | (cond | 3063 | (cond |
| 3091 | ((eq calc-display-raw t) (format "%s" a)) | 3064 | ((eq calc-display-raw t) (format "%s" a)) |
| 3092 | ((and (nth 1 calc-frac-format) (Math-integerp a)) | 3065 | ((and (nth 1 calc-frac-format) (Math-integerp a)) |
| 3093 | (calc-extensions) | 3066 | (require 'calc-ext) |
| 3094 | (math-format-number (math-adjust-fraction a))) | 3067 | (math-format-number (math-adjust-fraction a))) |
| 3095 | ((integerp a) | 3068 | ((integerp a) |
| 3096 | (if (not (or calc-group-digits calc-leading-zeros)) | 3069 | (if (not (or calc-group-digits calc-leading-zeros)) |
| @@ -3098,7 +3071,7 @@ See calc-keypad for details." | |||
| 3098 | (int-to-string a) | 3071 | (int-to-string a) |
| 3099 | (if (< a 0) | 3072 | (if (< a 0) |
| 3100 | (concat "-" (math-format-number (- a))) | 3073 | (concat "-" (math-format-number (- a))) |
| 3101 | (calc-extensions) | 3074 | (require 'calc-ext) |
| 3102 | (if math-radix-explicit-format | 3075 | (if math-radix-explicit-format |
| 3103 | (if calc-radix-formatter | 3076 | (if calc-radix-formatter |
| 3104 | (funcall calc-radix-formatter | 3077 | (funcall calc-radix-formatter |
| @@ -3193,7 +3166,7 @@ See calc-keypad for details." | |||
| 3193 | str (- eadj scale))))))) | 3166 | str (- eadj scale))))))) |
| 3194 | str))) | 3167 | str))) |
| 3195 | (t | 3168 | (t |
| 3196 | (calc-extensions) | 3169 | (require 'calc-ext) |
| 3197 | (math-format-number-fancy a prec)))) | 3170 | (math-format-number-fancy a prec)))) |
| 3198 | 3171 | ||
| 3199 | (defun math-format-bignum (a) ; [X L] | 3172 | (defun math-format-bignum (a) ; [X L] |
| @@ -3201,7 +3174,7 @@ See calc-keypad for details." | |||
| 3201 | (not calc-leading-zeros) | 3174 | (not calc-leading-zeros) |
| 3202 | (not calc-group-digits)) | 3175 | (not calc-group-digits)) |
| 3203 | (math-format-bignum-decimal a) | 3176 | (math-format-bignum-decimal a) |
| 3204 | (calc-extensions) | 3177 | (require 'calc-ext) |
| 3205 | (math-format-bignum-fancy a))) | 3178 | (math-format-bignum-fancy a))) |
| 3206 | 3179 | ||
| 3207 | (defun math-format-bignum-decimal (a) ; [X L] | 3180 | (defun math-format-bignum-decimal (a) ; [X L] |
| @@ -3243,7 +3216,7 @@ See calc-keypad for details." | |||
| 3243 | 3216 | ||
| 3244 | ;; Forms that require extensions module | 3217 | ;; Forms that require extensions module |
| 3245 | ((string-match "[^-+0-9eE.]" s) | 3218 | ((string-match "[^-+0-9eE.]" s) |
| 3246 | (calc-extensions) | 3219 | (require 'calc-ext) |
| 3247 | (math-read-number-fancy s)) | 3220 | (math-read-number-fancy s)) |
| 3248 | 3221 | ||
| 3249 | ;; Decimal point | 3222 | ;; Decimal point |
| @@ -3352,26 +3325,26 @@ See calc-keypad for details." | |||
| 3352 | (defun calc-grab-region (top bot arg) | 3325 | (defun calc-grab-region (top bot arg) |
| 3353 | "Parse the region as a vector of numbers and push it on the Calculator stack." | 3326 | "Parse the region as a vector of numbers and push it on the Calculator stack." |
| 3354 | (interactive "r\nP") | 3327 | (interactive "r\nP") |
| 3355 | (calc-extensions) | 3328 | (require 'calc-ext) |
| 3356 | (calc-do-grab-region top bot arg)) | 3329 | (calc-do-grab-region top bot arg)) |
| 3357 | 3330 | ||
| 3358 | ;;;###autoload | 3331 | ;;;###autoload |
| 3359 | (defun calc-grab-rectangle (top bot arg) | 3332 | (defun calc-grab-rectangle (top bot arg) |
| 3360 | "Parse a rectangle as a matrix of numbers and push it on the Calculator stack." | 3333 | "Parse a rectangle as a matrix of numbers and push it on the Calculator stack." |
| 3361 | (interactive "r\nP") | 3334 | (interactive "r\nP") |
| 3362 | (calc-extensions) | 3335 | (require 'calc-ext) |
| 3363 | (calc-do-grab-rectangle top bot arg)) | 3336 | (calc-do-grab-rectangle top bot arg)) |
| 3364 | 3337 | ||
| 3365 | (defun calc-grab-sum-down (top bot arg) | 3338 | (defun calc-grab-sum-down (top bot arg) |
| 3366 | "Parse a rectangle as a matrix of numbers and sum its columns." | 3339 | "Parse a rectangle as a matrix of numbers and sum its columns." |
| 3367 | (interactive "r\nP") | 3340 | (interactive "r\nP") |
| 3368 | (calc-extensions) | 3341 | (require 'calc-ext) |
| 3369 | (calc-do-grab-rectangle top bot arg 'calcFunc-reduced)) | 3342 | (calc-do-grab-rectangle top bot arg 'calcFunc-reduced)) |
| 3370 | 3343 | ||
| 3371 | (defun calc-grab-sum-across (top bot arg) | 3344 | (defun calc-grab-sum-across (top bot arg) |
| 3372 | "Parse a rectangle as a matrix of numbers and sum its rows." | 3345 | "Parse a rectangle as a matrix of numbers and sum its rows." |
| 3373 | (interactive "r\nP") | 3346 | (interactive "r\nP") |
| 3374 | (calc-extensions) | 3347 | (require 'calc-ext) |
| 3375 | (calc-do-grab-rectangle top bot arg 'calcFunc-reducea)) | 3348 | (calc-do-grab-rectangle top bot arg 'calcFunc-reducea)) |
| 3376 | 3349 | ||
| 3377 | 3350 | ||
| @@ -3379,7 +3352,7 @@ See calc-keypad for details." | |||
| 3379 | (defun calc-embedded (arg &optional end obeg oend) | 3352 | (defun calc-embedded (arg &optional end obeg oend) |
| 3380 | "Start Calc Embedded mode on the formula surrounding point." | 3353 | "Start Calc Embedded mode on the formula surrounding point." |
| 3381 | (interactive "P") | 3354 | (interactive "P") |
| 3382 | (calc-extensions) | 3355 | (require 'calc-ext) |
| 3383 | (calc-do-embedded arg end obeg oend)) | 3356 | (calc-do-embedded arg end obeg oend)) |
| 3384 | 3357 | ||
| 3385 | ;;;###autoload | 3358 | ;;;###autoload |
| @@ -3399,7 +3372,7 @@ Also looks for the equivalent TeX words, \\gets and \\evalto." | |||
| 3399 | 3372 | ||
| 3400 | ;;;###autoload | 3373 | ;;;###autoload |
| 3401 | (defmacro defmath (func args &rest body) ; [Public] | 3374 | (defmacro defmath (func args &rest body) ; [Public] |
| 3402 | (calc-extensions) | 3375 | (require 'calc-ext) |
| 3403 | (math-do-defmath func args body)) | 3376 | (math-do-defmath func args body)) |
| 3404 | 3377 | ||
| 3405 | ;;; Functions needed for Lucid Emacs support. | 3378 | ;;; Functions needed for Lucid Emacs support. |
| @@ -3427,11 +3400,13 @@ Also looks for the equivalent TeX words, \\gets and \\evalto." | |||
| 3427 | (setq unread-command-events nil))) | 3400 | (setq unread-command-events nil))) |
| 3428 | 3401 | ||
| 3429 | (when calc-always-load-extensions | 3402 | (when calc-always-load-extensions |
| 3430 | (calc-extensions) | 3403 | (require 'calc-ext) |
| 3431 | (calc-load-everything)) | 3404 | (calc-load-everything)) |
| 3432 | 3405 | ||
| 3433 | 3406 | ||
| 3434 | (run-hooks 'calc-load-hook) | 3407 | (run-hooks 'calc-load-hook) |
| 3435 | 3408 | ||
| 3409 | (provide 'calc) | ||
| 3410 | |||
| 3436 | ;;; arch-tag: 0c3b170c-4ce6-4eaf-8d9b-5834d1fe938f | 3411 | ;;; arch-tag: 0c3b170c-4ce6-4eaf-8d9b-5834d1fe938f |
| 3437 | ;;; calc.el ends here | 3412 | ;;; calc.el ends here |