1 |
;; Calculator for GNU Emacs, part II [calc-mode.el] |
;;; calc-mode.el --- calculator modes for Calc |
2 |
|
|
3 |
;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. |
;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. |
4 |
;; Written by Dave Gillespie, daveg@synaptics.com. |
|
5 |
|
;; Author: David Gillespie <daveg@synaptics.com> |
6 |
|
;; Maintainer: Colin Walters <walters@debian.org> |
7 |
|
|
8 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
9 |
|
|
22 |
;; file named COPYING. Among other things, the copyright notice |
;; file named COPYING. Among other things, the copyright notice |
23 |
;; and this notice must be preserved on all copies. |
;; and this notice must be preserved on all copies. |
24 |
|
|
25 |
|
;;; Commentary: |
26 |
|
|
27 |
|
;;; Code: |
28 |
|
|
29 |
|
|
30 |
;; This file is autoloaded from calc-ext.el. |
;; This file is autoloaded from calc-ext.el. |
39 |
(interactive "P") |
(interactive "P") |
40 |
(calc-wrapper |
(calc-wrapper |
41 |
(message (if (calc-change-mode 'calc-line-numbering n t t) |
(message (if (calc-change-mode 'calc-line-numbering n t t) |
42 |
"Displaying stack level numbers." |
"Displaying stack level numbers" |
43 |
"Hiding stack level numbers.")))) |
"Hiding stack level numbers")))) |
44 |
|
|
45 |
(defun calc-line-breaking (n) |
(defun calc-line-breaking (n) |
46 |
(interactive "P") |
(interactive "P") |
52 |
(not calc-line-breaking))) |
(not calc-line-breaking))) |
53 |
(if (calc-change-mode 'calc-line-breaking n t) |
(if (calc-change-mode 'calc-line-breaking n t) |
54 |
(if (integerp calc-line-breaking) |
(if (integerp calc-line-breaking) |
55 |
(message "Breaking lines longer than %d characters." n) |
(message "Breaking lines longer than %d characters" n) |
56 |
(message "Breaking long lines in Stack display.")) |
(message "Breaking long lines in Stack display")) |
57 |
(message "Not breaking long lines in Stack display.")))) |
(message "Not breaking long lines in Stack display")))) |
58 |
|
|
59 |
|
|
60 |
(defun calc-left-justify (n) |
(defun calc-left-justify (n) |
64 |
(calc-change-mode '(calc-display-just calc-display-origin) |
(calc-change-mode '(calc-display-just calc-display-origin) |
65 |
(list nil n) t) |
(list nil n) t) |
66 |
(if n |
(if n |
67 |
(message "Displaying stack entries indented by %d." n) |
(message "Displaying stack entries indented by %d" n) |
68 |
(message "Displaying stack entries left-justified.")))) |
(message "Displaying stack entries left-justified")))) |
69 |
|
|
70 |
(defun calc-center-justify (n) |
(defun calc-center-justify (n) |
71 |
(interactive "P") |
(interactive "P") |
74 |
(calc-change-mode '(calc-display-just calc-display-origin) |
(calc-change-mode '(calc-display-just calc-display-origin) |
75 |
(list 'center n) t) |
(list 'center n) t) |
76 |
(if n |
(if n |
77 |
(message "Displaying stack entries centered on column %d." n) |
(message "Displaying stack entries centered on column %d" n) |
78 |
(message "Displaying stack entries centered in window.")))) |
(message "Displaying stack entries centered in window")))) |
79 |
|
|
80 |
(defun calc-right-justify (n) |
(defun calc-right-justify (n) |
81 |
(interactive "P") |
(interactive "P") |
84 |
(calc-change-mode '(calc-display-just calc-display-origin) |
(calc-change-mode '(calc-display-just calc-display-origin) |
85 |
(list 'right n) t) |
(list 'right n) t) |
86 |
(if n |
(if n |
87 |
(message "Displaying stack entries right-justified to column %d." n) |
(message "Displaying stack entries right-justified to column %d" n) |
88 |
(message "Displaying stack entries right-justified in window.")))) |
(message "Displaying stack entries right-justified in window")))) |
89 |
|
|
90 |
(defun calc-left-label (s) |
(defun calc-left-label (s) |
91 |
(interactive "sLefthand label: ") |
(interactive "sLefthand label: ") |
112 |
(setq n (and (not (eq calc-auto-why t)) (if calc-auto-why t 1)))) |
(setq n (and (not (eq calc-auto-why t)) (if calc-auto-why t 1)))) |
113 |
(calc-change-mode 'calc-auto-why n nil) |
(calc-change-mode 'calc-auto-why n nil) |
114 |
(cond ((null n) |
(cond ((null n) |
115 |
(message "User must press `w' to explain unsimplified results.")) |
(message "User must press `w' to explain unsimplified results")) |
116 |
((eq n t) |
((eq n t) |
117 |
(message "Automatically doing `w' to explain unsimplified results.")) |
(message "Automatically doing `w' to explain unsimplified results")) |
118 |
(t |
(t |
119 |
(message "Automatically doing `w' only for unusual messages."))))) |
(message "Automatically doing `w' only for unusual messages"))))) |
120 |
|
|
121 |
(defun calc-group-digits (n) |
(defun calc-group-digits (n) |
122 |
(interactive "P") |
(interactive "P") |
132 |
(setq n (not calc-group-digits))) |
(setq n (not calc-group-digits))) |
133 |
(calc-change-mode 'calc-group-digits n t) |
(calc-change-mode 'calc-group-digits n t) |
134 |
(cond ((null n) |
(cond ((null n) |
135 |
(message "Grouping is off.")) |
(message "Grouping is off")) |
136 |
((integerp n) |
((integerp n) |
137 |
(message "Grouping every %d digits." (math-abs n))) |
(message "Grouping every %d digits" (math-abs n))) |
138 |
(t |
(t |
139 |
(message "Grouping is on."))))) |
(message "Grouping is on"))))) |
140 |
|
|
141 |
(defun calc-group-char (ch) |
(defun calc-group-char (ch) |
142 |
(interactive "cGrouping character: ") |
(interactive "cGrouping character: ") |
143 |
(calc-wrapper |
(calc-wrapper |
144 |
(or (>= ch 32) |
(or (>= ch 32) |
145 |
(error "Control characters not allowed for grouping.")) |
(error "Control characters not allowed for grouping")) |
146 |
(if (= ch ?\\) |
(if (= ch ?\\) |
147 |
(setq ch "\\,") |
(setq ch "\\,") |
148 |
(setq ch (char-to-string ch))) |
(setq ch (char-to-string ch))) |
149 |
(calc-change-mode 'calc-group-char ch calc-group-digits) |
(calc-change-mode 'calc-group-char ch calc-group-digits) |
150 |
(message "Digit grouping character is \"%s\"." ch))) |
(message "Digit grouping character is \"%s\"" ch))) |
151 |
|
|
152 |
(defun calc-point-char (ch) |
(defun calc-point-char (ch) |
153 |
(interactive "cCharacter to use as decimal point: ") |
(interactive "cCharacter to use as decimal point: ") |
154 |
(calc-wrapper |
(calc-wrapper |
155 |
(or (>= ch 32) |
(or (>= ch 32) |
156 |
(error "Control characters not allowed as decimal point.")) |
(error "Control characters not allowed as decimal point")) |
157 |
(calc-change-mode 'calc-point-char (char-to-string ch) t) |
(calc-change-mode 'calc-point-char (char-to-string ch) t) |
158 |
(message "Decimal point character is \"%c\"." ch))) |
(message "Decimal point character is \"%c\"" ch))) |
159 |
|
|
160 |
(defun calc-normal-notation (n) |
(defun calc-normal-notation (n) |
161 |
(interactive "P") |
(interactive "P") |
169 |
(- (% (+ val 5000) 10000) 5000)))) |
(- (% (+ val 5000) 10000) 5000)))) |
170 |
t) |
t) |
171 |
(if (eq (nth 1 n) 0) |
(if (eq (nth 1 n) 0) |
172 |
(message "Displaying floating-point numbers normally.") |
(message "Displaying floating-point numbers normally") |
173 |
(if (> (nth 1 n) 0) |
(if (> (nth 1 n) 0) |
174 |
(message |
(message |
175 |
"Displaying floating-point numbers with %d significant digits." |
"Displaying floating-point numbers with %d significant digits" |
176 |
(nth 1 n)) |
(nth 1 n)) |
177 |
(message "Displaying floating-point numbers with (precision%d)." |
(message "Displaying floating-point numbers with (precision%d)" |
178 |
(nth 1 n)))))) |
(nth 1 n)))))) |
179 |
|
|
180 |
(defun calc-fix-notation (n) |
(defun calc-fix-notation (n) |
183 |
(calc-change-mode 'calc-float-format |
(calc-change-mode 'calc-float-format |
184 |
(setq n (list 'fix (if n (prefix-numeric-value n) 0))) |
(setq n (list 'fix (if n (prefix-numeric-value n) 0))) |
185 |
t) |
t) |
186 |
(message "Displaying floats with %d digits after decimal." |
(message "Displaying floats with %d digits after decimal" |
187 |
(math-abs (nth 1 n))))) |
(math-abs (nth 1 n))))) |
188 |
|
|
189 |
(defun calc-sci-notation (n) |
(defun calc-sci-notation (n) |
193 |
(setq n (list 'sci (if n (prefix-numeric-value n) 0))) |
(setq n (list 'sci (if n (prefix-numeric-value n) 0))) |
194 |
t) |
t) |
195 |
(if (eq (nth 1 n) 0) |
(if (eq (nth 1 n) 0) |
196 |
(message "Displaying floats in scientific notation.") |
(message "Displaying floats in scientific notation") |
197 |
(if (> (nth 1 n) 0) |
(if (> (nth 1 n) 0) |
198 |
(message "Displaying scientific notation with %d significant digits." |
(message "Displaying scientific notation with %d significant digits" |
199 |
(nth 1 n)) |
(nth 1 n)) |
200 |
(message "Displaying scientific notation with (precision%d)." |
(message "Displaying scientific notation with (precision%d)" |
201 |
(nth 1 n)))))) |
(nth 1 n)))))) |
202 |
|
|
203 |
(defun calc-eng-notation (n) |
(defun calc-eng-notation (n) |
207 |
(setq n (list 'eng (if n (prefix-numeric-value n) 0))) |
(setq n (list 'eng (if n (prefix-numeric-value n) 0))) |
208 |
t) |
t) |
209 |
(if (eq (nth 1 n) 0) |
(if (eq (nth 1 n) 0) |
210 |
(message "Displaying floats in engineering notation.") |
(message "Displaying floats in engineering notation") |
211 |
(if (> (nth 1 n) 0) |
(if (> (nth 1 n) 0) |
212 |
(message "Displaying engineering notation with %d significant digits." |
(message "Displaying engineering notation with %d significant digits" |
213 |
(nth 1 n)) |
(nth 1 n)) |
214 |
(message "Displaying engineering notation with (precision%d)." |
(message "Displaying engineering notation with (precision%d)" |
215 |
(nth 1 n)))))) |
(nth 1 n)))))) |
216 |
|
|
217 |
|
|
260 |
(setq calc-display-raw (if calc-display-raw nil (if arg 0 t))) |
(setq calc-display-raw (if calc-display-raw nil (if arg 0 t))) |
261 |
(calc-do-refresh) |
(calc-do-refresh) |
262 |
(if calc-display-raw |
(if calc-display-raw |
263 |
(message "Press d ' again to cancel \"raw\" display mode.")))) |
(message "Press d ' again to cancel \"raw\" display mode")))) |
264 |
|
|
265 |
|
|
266 |
|
|
273 |
(let (pos |
(let (pos |
274 |
(vals (mapcar (function (lambda (v) (symbol-value (car v)))) |
(vals (mapcar (function (lambda (v) (symbol-value (car v)))) |
275 |
calc-mode-var-list))) |
calc-mode-var-list))) |
276 |
|
(unless calc-settings-file |
277 |
|
(error "No `calc-settings-file' specified")) |
278 |
(set-buffer (find-file-noselect (substitute-in-file-name |
(set-buffer (find-file-noselect (substitute-in-file-name |
279 |
calc-settings-file))) |
calc-settings-file))) |
280 |
(goto-char (point-min)) |
(goto-char (point-min)) |
332 |
;; FIXME: we should use ~/.calc or so in order to avoid |
;; FIXME: we should use ~/.calc or so in order to avoid |
333 |
;; reexecuting ~/.emacs (it's not always idempotent) -cgw 2001.11.12 |
;; reexecuting ~/.emacs (it's not always idempotent) -cgw 2001.11.12 |
334 |
(setq calc-settings-file name) |
(setq calc-settings-file name) |
335 |
(or (and (string-match "\\.emacs" calc-settings-file) |
(or (and |
336 |
|
calc-settings-file |
337 |
|
(string-match "\\.emacs" calc-settings-file) |
338 |
(> arg 0)) |
(> arg 0)) |
339 |
(< arg 0) |
(< arg 0) |
340 |
(load name t) |
(load name t) |
425 |
((eq calc-mode-save-mode 'global) |
((eq calc-mode-save-mode 'global) |
426 |
"Recording mode changes with [calc-global-mode: ...]") |
"Recording mode changes with [calc-global-mode: ...]") |
427 |
((eq calc-mode-save-mode 'save) |
((eq calc-mode-save-mode 'save) |
428 |
(format "Recording mode changes in \"%s\"." |
(format "Recording mode changes in \"%s\"" |
429 |
calc-settings-file)) |
calc-settings-file)) |
430 |
(t |
(t |
431 |
"Not recording mode changes permanently."))))) |
"Not recording mode changes permanently"))))) |
432 |
|
|
433 |
(defun calc-total-algebraic-mode (flag) |
(defun calc-total-algebraic-mode (flag) |
434 |
(interactive "P") |
(interactive "P") |
441 |
'(total nil)) |
'(total nil)) |
442 |
(use-local-map calc-alg-map) |
(use-local-map calc-alg-map) |
443 |
(message |
(message |
444 |
"All keys begin algebraic entry; use Meta (ESC) for Calc keys.")))) |
"All keys begin algebraic entry; use Meta (ESC) for Calc keys")))) |
445 |
|
|
446 |
(defun calc-algebraic-mode (flag) |
(defun calc-algebraic-mode (flag) |
447 |
(interactive "P") |
(interactive "P") |
454 |
(list (not calc-algebraic-mode) nil))) |
(list (not calc-algebraic-mode) nil))) |
455 |
(use-local-map calc-mode-map) |
(use-local-map calc-mode-map) |
456 |
(message (if calc-algebraic-mode |
(message (if calc-algebraic-mode |
457 |
"Numeric keys and ( and [ begin algebraic entry." |
"Numeric keys and ( and [ begin algebraic entry" |
458 |
(if calc-incomplete-algebraic-mode |
(if calc-incomplete-algebraic-mode |
459 |
"Only ( and [ begin algebraic entry." |
"Only ( and [ begin algebraic entry" |
460 |
"No keys except ' and $ begin algebraic entry."))))) |
"No keys except ' and $ begin algebraic entry"))))) |
461 |
|
|
462 |
(defun calc-symbolic-mode (n) |
(defun calc-symbolic-mode (n) |
463 |
(interactive "P") |
(interactive "P") |
464 |
(calc-wrapper |
(calc-wrapper |
465 |
|
|
466 |
(message (if (calc-change-mode 'calc-symbolic-mode n nil t) |
(message (if (calc-change-mode 'calc-symbolic-mode n nil t) |
467 |
"Inexact computations like sqrt(2) are deferred." |
"Inexact computations like sqrt(2) are deferred" |
468 |
"Numerical computations are always done immediately.")))) |
"Numerical computations are always done immediately")))) |
469 |
|
|
470 |
(defun calc-infinite-mode (n) |
(defun calc-infinite-mode (n) |
471 |
(interactive "P") |
(interactive "P") |
473 |
(if (eq n 0) |
(if (eq n 0) |
474 |
(progn |
(progn |
475 |
(calc-change-mode 'calc-infinite-mode 1) |
(calc-change-mode 'calc-infinite-mode 1) |
476 |
(message "Computations like 1 / 0 produce \"inf\".")) |
(message "Computations like 1 / 0 produce \"inf\"")) |
477 |
(message (if (calc-change-mode 'calc-infinite-mode n nil t) |
(message (if (calc-change-mode 'calc-infinite-mode n nil t) |
478 |
"Computations like 1 / 0 produce \"uinf\"." |
"Computations like 1 / 0 produce \"uinf\"" |
479 |
"Computations like 1 / 0 are left unsimplified."))))) |
"Computations like 1 / 0 are left unsimplified"))))) |
480 |
|
|
481 |
(defun calc-matrix-mode (arg) |
(defun calc-matrix-mode (arg) |
482 |
(interactive "P") |
(interactive "P") |
490 |
((eq calc-matrix-mode 'scalar) nil) |
((eq calc-matrix-mode 'scalar) nil) |
491 |
(t 'matrix))) |
(t 'matrix))) |
492 |
(if (integerp calc-matrix-mode) |
(if (integerp calc-matrix-mode) |
493 |
(message "Variables are assumed to be %dx%d matrices." |
(message "Variables are assumed to be %dx%d matrices" |
494 |
calc-matrix-mode calc-matrix-mode) |
calc-matrix-mode calc-matrix-mode) |
495 |
(message (if (eq calc-matrix-mode 'matrix) |
(message (if (eq calc-matrix-mode 'matrix) |
496 |
"Variables are assumed to be matrices." |
"Variables are assumed to be matrices" |
497 |
(if calc-matrix-mode |
(if calc-matrix-mode |
498 |
"Variables are assumed to be scalars (non-matrices)." |
"Variables are assumed to be scalars (non-matrices)" |
499 |
"Variables are not assumed to be matrix or scalar.")))))) |
"Variables are not assumed to be matrix or scalar")))))) |
500 |
|
|
501 |
(defun calc-set-simplify-mode (mode arg msg) |
(defun calc-set-simplify-mode (mode arg msg) |
502 |
(calc-change-mode 'calc-simplify-mode |
(calc-change-mode 'calc-simplify-mode |
507 |
mode))) |
mode))) |
508 |
(message (if (eq calc-simplify-mode mode) |
(message (if (eq calc-simplify-mode mode) |
509 |
msg |
msg |
510 |
"Default simplifications enabled."))) |
"Default simplifications enabled"))) |
511 |
|
|
512 |
(defun calc-no-simplify-mode (arg) |
(defun calc-no-simplify-mode (arg) |
513 |
(interactive "P") |
(interactive "P") |
514 |
(calc-wrapper |
(calc-wrapper |
515 |
(calc-set-simplify-mode 'none arg |
(calc-set-simplify-mode 'none arg |
516 |
"All default simplifications are disabled."))) |
"All default simplifications are disabled"))) |
517 |
|
|
518 |
(defun calc-num-simplify-mode (arg) |
(defun calc-num-simplify-mode (arg) |
519 |
(interactive "P") |
(interactive "P") |
520 |
(calc-wrapper |
(calc-wrapper |
521 |
(calc-set-simplify-mode 'num arg |
(calc-set-simplify-mode 'num arg |
522 |
"Default simplifications apply only if arguments are numeric."))) |
"Default simplifications apply only if arguments are numeric"))) |
523 |
|
|
524 |
(defun calc-default-simplify-mode (arg) |
(defun calc-default-simplify-mode (arg) |
525 |
(interactive "p") |
(interactive "p") |
526 |
(cond ((= arg 1) |
(cond ((= arg 1) |
527 |
(calc-wrapper |
(calc-wrapper |
528 |
(calc-set-simplify-mode |
(calc-set-simplify-mode |
529 |
nil nil "Usual default simplifications are enabled."))) |
nil nil "Usual default simplifications are enabled"))) |
530 |
((= arg 0) (calc-num-simplify-mode 1)) |
((= arg 0) (calc-num-simplify-mode 1)) |
531 |
((< arg 0) (calc-no-simplify-mode 1)) |
((< arg 0) (calc-no-simplify-mode 1)) |
532 |
((= arg 2) (calc-bin-simplify-mode 1)) |
((= arg 2) (calc-bin-simplify-mode 1)) |
539 |
(interactive "P") |
(interactive "P") |
540 |
(calc-wrapper |
(calc-wrapper |
541 |
(calc-set-simplify-mode 'binary arg |
(calc-set-simplify-mode 'binary arg |
542 |
(format "Binary simplification occurs by default (word size=%d)." |
(format "Binary simplification occurs by default (word size=%d)" |
543 |
calc-word-size)))) |
calc-word-size)))) |
544 |
|
|
545 |
(defun calc-alg-simplify-mode (arg) |
(defun calc-alg-simplify-mode (arg) |
546 |
(interactive "P") |
(interactive "P") |
547 |
(calc-wrapper |
(calc-wrapper |
548 |
(calc-set-simplify-mode 'alg arg |
(calc-set-simplify-mode 'alg arg |
549 |
"Algebraic simplification occurs by default."))) |
"Algebraic simplification occurs by default"))) |
550 |
|
|
551 |
(defun calc-ext-simplify-mode (arg) |
(defun calc-ext-simplify-mode (arg) |
552 |
(interactive "P") |
(interactive "P") |
553 |
(calc-wrapper |
(calc-wrapper |
554 |
(calc-set-simplify-mode 'ext arg |
(calc-set-simplify-mode 'ext arg |
555 |
"Extended algebraic simplification occurs by default."))) |
"Extended algebraic simplification occurs by default"))) |
556 |
|
|
557 |
(defun calc-units-simplify-mode (arg) |
(defun calc-units-simplify-mode (arg) |
558 |
(interactive "P") |
(interactive "P") |
559 |
(calc-wrapper |
(calc-wrapper |
560 |
(calc-set-simplify-mode 'units arg |
(calc-set-simplify-mode 'units arg |
561 |
"Units simplification occurs by default."))) |
"Units simplification occurs by default"))) |
562 |
|
|
563 |
(defun calc-auto-recompute (arg) |
(defun calc-auto-recompute (arg) |
564 |
(interactive "P") |
(interactive "P") |
566 |
(calc-change-mode 'calc-auto-recompute arg nil t) |
(calc-change-mode 'calc-auto-recompute arg nil t) |
567 |
(calc-refresh-evaltos) |
(calc-refresh-evaltos) |
568 |
(message (if calc-auto-recompute |
(message (if calc-auto-recompute |
569 |
"Automatically recomputing `=>' forms when necessary." |
"Automatically recomputing `=>' forms when necessary" |
570 |
"Not recomputing `=>' forms automatically.")))) |
"Not recomputing `=>' forms automatically")))) |
571 |
|
|
572 |
(defun calc-working (n) |
(defun calc-working (n) |
573 |
(interactive "P") |
(interactive "P") |
581 |
((eq n 0) (calc-change-mode 'calc-display-working-message nil)) |
((eq n 0) (calc-change-mode 'calc-display-working-message nil)) |
582 |
((eq n 1) (calc-change-mode 'calc-display-working-message t))) |
((eq n 1) (calc-change-mode 'calc-display-working-message t))) |
583 |
(cond ((eq calc-display-working-message t) |
(cond ((eq calc-display-working-message t) |
584 |
(message "\"Working...\" messages enabled.")) |
(message "\"Working...\" messages enabled")) |
585 |
(calc-display-working-message |
(calc-display-working-message |
586 |
(message "Detailed \"Working...\" messages enabled.")) |
(message "Detailed \"Working...\" messages enabled")) |
587 |
(t |
(t |
588 |
(message "\"Working...\" messages disabled."))))) |
(message "\"Working...\" messages disabled"))))) |
589 |
|
|
590 |
(defun calc-always-load-extensions () |
(defun calc-always-load-extensions () |
591 |
(interactive) |
(interactive) |
592 |
(calc-wrapper |
(calc-wrapper |
593 |
(if (setq calc-always-load-extensions (not calc-always-load-extensions)) |
(if (setq calc-always-load-extensions (not calc-always-load-extensions)) |
594 |
(message "Always loading extensions package.") |
(message "Always loading extensions package") |
595 |
(message "Loading extensions package on demand only.")))) |
(message "Loading extensions package on demand only")))) |
596 |
|
|
597 |
|
|
598 |
(defun calc-matrix-left-justify () |
(defun calc-matrix-left-justify () |
599 |
(interactive) |
(interactive) |
600 |
(calc-wrapper |
(calc-wrapper |
601 |
(calc-change-mode 'calc-matrix-just nil t) |
(calc-change-mode 'calc-matrix-just nil t) |
602 |
(message "Matrix elements will be left-justified in columns."))) |
(message "Matrix elements will be left-justified in columns"))) |
603 |
|
|
604 |
(defun calc-matrix-center-justify () |
(defun calc-matrix-center-justify () |
605 |
(interactive) |
(interactive) |
606 |
(calc-wrapper |
(calc-wrapper |
607 |
(calc-change-mode 'calc-matrix-just 'center t) |
(calc-change-mode 'calc-matrix-just 'center t) |
608 |
(message "Matrix elements will be centered in columns."))) |
(message "Matrix elements will be centered in columns"))) |
609 |
|
|
610 |
(defun calc-matrix-right-justify () |
(defun calc-matrix-right-justify () |
611 |
(interactive) |
(interactive) |
612 |
(calc-wrapper |
(calc-wrapper |
613 |
(calc-change-mode 'calc-matrix-just 'right t) |
(calc-change-mode 'calc-matrix-just 'right t) |
614 |
(message "Matrix elements will be right-justified in columns."))) |
(message "Matrix elements will be right-justified in columns"))) |
615 |
|
|
616 |
(defun calc-full-vectors (n) |
(defun calc-full-vectors (n) |
617 |
(interactive "P") |
(interactive "P") |
618 |
(calc-wrapper |
(calc-wrapper |
619 |
(message (if (calc-change-mode 'calc-full-vectors n t t) |
(message (if (calc-change-mode 'calc-full-vectors n t t) |
620 |
"Displaying long vectors in full." |
"Displaying long vectors in full" |
621 |
"Displaying long vectors in [a, b, c, ..., z] notation.")))) |
"Displaying long vectors in [a, b, c, ..., z] notation")))) |
622 |
|
|
623 |
(defun calc-full-trail-vectors (n) |
(defun calc-full-trail-vectors (n) |
624 |
(interactive "P") |
(interactive "P") |
625 |
(calc-wrapper |
(calc-wrapper |
626 |
(message (if (calc-change-mode 'calc-full-trail-vectors n nil t) |
(message (if (calc-change-mode 'calc-full-trail-vectors n nil t) |
627 |
"Recording long vectors in full." |
"Recording long vectors in full" |
628 |
"Recording long vectors in [a, b, c, ..., z] notation.")))) |
"Recording long vectors in [a, b, c, ..., z] notation")))) |
629 |
|
|
630 |
(defun calc-break-vectors (n) |
(defun calc-break-vectors (n) |
631 |
(interactive "P") |
(interactive "P") |
632 |
(calc-wrapper |
(calc-wrapper |
633 |
(message (if (calc-change-mode 'calc-break-vectors n t t) |
(message (if (calc-change-mode 'calc-break-vectors n t t) |
634 |
"Displaying vector elements one-per-line." |
"Displaying vector elements one-per-line" |
635 |
"Displaying vector elements all on one line.")))) |
"Displaying vector elements all on one line")))) |
636 |
|
|
637 |
(defun calc-vector-commas () |
(defun calc-vector-commas () |
638 |
(interactive) |
(interactive) |
639 |
(calc-wrapper |
(calc-wrapper |
640 |
(if (calc-change-mode 'calc-vector-commas (if calc-vector-commas nil ",") t) |
(if (calc-change-mode 'calc-vector-commas (if calc-vector-commas nil ",") t) |
641 |
(message "Separating vector elements with \",\".") |
(message "Separating vector elements with \",\"") |
642 |
(message "Separating vector elements with spaces.")))) |
(message "Separating vector elements with spaces")))) |
643 |
|
|
644 |
(defun calc-vector-brackets () |
(defun calc-vector-brackets () |
645 |
(interactive) |
(interactive) |
646 |
(calc-wrapper |
(calc-wrapper |
647 |
(if (calc-change-mode 'calc-vector-brackets |
(if (calc-change-mode 'calc-vector-brackets |
648 |
(if (equal calc-vector-brackets "[]") nil "[]") t) |
(if (equal calc-vector-brackets "[]") nil "[]") t) |
649 |
(message "Surrounding vectors with \"[]\".") |
(message "Surrounding vectors with \"[]\"") |
650 |
(message "Not surrounding vectors with brackets.")))) |
(message "Not surrounding vectors with brackets")))) |
651 |
|
|
652 |
(defun calc-vector-braces () |
(defun calc-vector-braces () |
653 |
(interactive) |
(interactive) |
654 |
(calc-wrapper |
(calc-wrapper |
655 |
(if (calc-change-mode 'calc-vector-brackets |
(if (calc-change-mode 'calc-vector-brackets |
656 |
(if (equal calc-vector-brackets "{}") nil "{}") t) |
(if (equal calc-vector-brackets "{}") nil "{}") t) |
657 |
(message "Surrounding vectors with \"{}\".") |
(message "Surrounding vectors with \"{}\"") |
658 |
(message "Not surrounding vectors with brackets.")))) |
(message "Not surrounding vectors with brackets")))) |
659 |
|
|
660 |
(defun calc-vector-parens () |
(defun calc-vector-parens () |
661 |
(interactive) |
(interactive) |
662 |
(calc-wrapper |
(calc-wrapper |
663 |
(if (calc-change-mode 'calc-vector-brackets |
(if (calc-change-mode 'calc-vector-brackets |
664 |
(if (equal calc-vector-brackets "()") nil "()") t) |
(if (equal calc-vector-brackets "()") nil "()") t) |
665 |
(message "Surrounding vectors with \"()\".") |
(message "Surrounding vectors with \"()\"") |
666 |
(message "Not surrounding vectors with brackets.")))) |
(message "Not surrounding vectors with brackets")))) |
667 |
|
|
668 |
(defun calc-matrix-brackets (arg) |
(defun calc-matrix-brackets (arg) |
669 |
(interactive "sCode letters (R, O, C, P): ") |
(interactive "sCode letters (R, O, C, P): ") |