Mercurial > emacs
annotate lisp/calc/calc-mode.el @ 65626:69a9e146ef35
(add_sym): Compare namespace names instead of namespace objects. This
prevents the parser from incorrectly treating classes whose superclass
is in another namespace.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 20 Sep 2005 13:19:29 +0000 |
parents | 1038e6fc7f28 |
children | f4c158053fb0 fa0da9b57058 |
rev | line source |
---|---|
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
1 ;;; calc-mode.el --- calculator modes for Calc |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
2 |
64325
1db49616ce05
Update copyright information.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62442
diff
changeset
|
3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, |
1db49616ce05
Update copyright information.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62442
diff
changeset
|
4 ;; 2005 Free Software Foundation, Inc. |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
5 |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
6 ;; Author: David Gillespie <daveg@synaptics.com> |
58665
eb797263e910
Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
57592
diff
changeset
|
7 ;; Maintainer: Jay Belanger <belanger@truman.edu> |
40785 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is distributed in the hope that it will be useful, | |
12 ;; but WITHOUT ANY WARRANTY. No author or distributor | |
13 ;; accepts responsibility to anyone for the consequences of using it | |
14 ;; or for whether it serves any particular purpose or works at all, | |
15 ;; unless he says so in writing. Refer to the GNU Emacs General Public | |
16 ;; License for full details. | |
17 | |
18 ;; Everyone is granted permission to copy, modify and redistribute | |
19 ;; GNU Emacs, but only under the conditions described in the | |
20 ;; GNU Emacs General Public License. A copy of this license is | |
21 ;; supposed to have been given to you along with GNU Emacs so you | |
22 ;; can know your rights and responsibilities. It should be in a | |
23 ;; file named COPYING. Among other things, the copyright notice | |
24 ;; and this notice must be preserved on all copies. | |
25 | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
26 ;;; Commentary: |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
27 |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
28 ;;; Code: |
40785 | 29 |
30 ;; This file is autoloaded from calc-ext.el. | |
31 | |
58665
eb797263e910
Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
57592
diff
changeset
|
32 (require 'calc-ext) |
40785 | 33 (require 'calc-macs) |
34 | |
35 (defun calc-line-numbering (n) | |
36 (interactive "P") | |
37 (calc-wrapper | |
38 (message (if (calc-change-mode 'calc-line-numbering n t t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
39 "Displaying stack level numbers" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
40 "Hiding stack level numbers")))) |
40785 | 41 |
42 (defun calc-line-breaking (n) | |
43 (interactive "P") | |
44 (calc-wrapper | |
45 (setq n (if n | |
46 (and (> (setq n (prefix-numeric-value n)) 0) | |
47 (or (< n 5) | |
48 n)) | |
49 (not calc-line-breaking))) | |
50 (if (calc-change-mode 'calc-line-breaking n t) | |
51 (if (integerp calc-line-breaking) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
52 (message "Breaking lines longer than %d characters" n) |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
53 (message "Breaking long lines in Stack display")) |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
54 (message "Not breaking long lines in Stack display")))) |
40785 | 55 |
56 | |
57 (defun calc-left-justify (n) | |
58 (interactive "P") | |
59 (calc-wrapper | |
60 (and n (setq n (prefix-numeric-value n))) | |
61 (calc-change-mode '(calc-display-just calc-display-origin) | |
62 (list nil n) t) | |
63 (if n | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
64 (message "Displaying stack entries indented by %d" n) |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
65 (message "Displaying stack entries left-justified")))) |
40785 | 66 |
67 (defun calc-center-justify (n) | |
68 (interactive "P") | |
69 (calc-wrapper | |
70 (and n (setq n (prefix-numeric-value n))) | |
71 (calc-change-mode '(calc-display-just calc-display-origin) | |
72 (list 'center n) t) | |
73 (if n | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
74 (message "Displaying stack entries centered on column %d" n) |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
75 (message "Displaying stack entries centered in window")))) |
40785 | 76 |
77 (defun calc-right-justify (n) | |
78 (interactive "P") | |
79 (calc-wrapper | |
80 (and n (setq n (prefix-numeric-value n))) | |
81 (calc-change-mode '(calc-display-just calc-display-origin) | |
82 (list 'right n) t) | |
83 (if n | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
84 (message "Displaying stack entries right-justified to column %d" n) |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
85 (message "Displaying stack entries right-justified in window")))) |
40785 | 86 |
87 (defun calc-left-label (s) | |
88 (interactive "sLefthand label: ") | |
89 (calc-wrapper | |
90 (or (equal s "") | |
91 (setq s (concat s " "))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
92 (calc-change-mode 'calc-left-label s t))) |
40785 | 93 |
94 (defun calc-right-label (s) | |
95 (interactive "sRighthand label: ") | |
96 (calc-wrapper | |
97 (or (equal s "") | |
98 (setq s (concat " " s))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
99 (calc-change-mode 'calc-right-label s t))) |
40785 | 100 |
101 (defun calc-auto-why (n) | |
102 (interactive "P") | |
103 (calc-wrapper | |
104 (if n | |
105 (progn | |
106 (setq n (prefix-numeric-value n)) | |
107 (if (<= n 0) (setq n nil) | |
108 (if (> n 1) (setq n t)))) | |
109 (setq n (and (not (eq calc-auto-why t)) (if calc-auto-why t 1)))) | |
110 (calc-change-mode 'calc-auto-why n nil) | |
111 (cond ((null n) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
112 (message "User must press `w' to explain unsimplified results")) |
40785 | 113 ((eq n t) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
114 (message "Automatically doing `w' to explain unsimplified results")) |
40785 | 115 (t |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
116 (message "Automatically doing `w' only for unusual messages"))))) |
40785 | 117 |
118 (defun calc-group-digits (n) | |
119 (interactive "P") | |
120 (calc-wrapper | |
121 (if n | |
122 (progn | |
123 (setq n (prefix-numeric-value n)) | |
124 (cond ((or (> n 0) (< n -1))) | |
125 ((= n -1) | |
126 (setq n nil)) | |
127 (t | |
128 (setq n calc-group-digits)))) | |
129 (setq n (not calc-group-digits))) | |
130 (calc-change-mode 'calc-group-digits n t) | |
131 (cond ((null n) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
132 (message "Grouping is off")) |
40785 | 133 ((integerp n) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
134 (message "Grouping every %d digits" (math-abs n))) |
40785 | 135 (t |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
136 (message "Grouping is on"))))) |
40785 | 137 |
138 (defun calc-group-char (ch) | |
139 (interactive "cGrouping character: ") | |
140 (calc-wrapper | |
141 (or (>= ch 32) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
142 (error "Control characters not allowed for grouping")) |
40785 | 143 (if (= ch ?\\) |
144 (setq ch "\\,") | |
145 (setq ch (char-to-string ch))) | |
146 (calc-change-mode 'calc-group-char ch calc-group-digits) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
147 (message "Digit grouping character is \"%s\"" ch))) |
40785 | 148 |
149 (defun calc-point-char (ch) | |
150 (interactive "cCharacter to use as decimal point: ") | |
151 (calc-wrapper | |
152 (or (>= ch 32) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
153 (error "Control characters not allowed as decimal point")) |
40785 | 154 (calc-change-mode 'calc-point-char (char-to-string ch) t) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
155 (message "Decimal point character is \"%c\"" ch))) |
40785 | 156 |
157 (defun calc-normal-notation (n) | |
158 (interactive "P") | |
159 (calc-wrapper | |
160 (calc-change-mode 'calc-float-format | |
161 (let* ((val (if n (prefix-numeric-value n) 0)) | |
162 (mode (/ (+ val 5000) 10000))) | |
163 (if (or (< val -5000) (> mode 3)) | |
164 (error "Prefix out of range")) | |
165 (setq n (list (aref [float sci eng fix] mode) | |
166 (- (% (+ val 5000) 10000) 5000)))) | |
167 t) | |
168 (if (eq (nth 1 n) 0) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
169 (message "Displaying floating-point numbers normally") |
40785 | 170 (if (> (nth 1 n) 0) |
171 (message | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
172 "Displaying floating-point numbers with %d significant digits" |
40785 | 173 (nth 1 n)) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
174 (message "Displaying floating-point numbers with (precision%d)" |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
175 (nth 1 n)))))) |
40785 | 176 |
177 (defun calc-fix-notation (n) | |
178 (interactive "NDigits after decimal point: ") | |
179 (calc-wrapper | |
180 (calc-change-mode 'calc-float-format | |
181 (setq n (list 'fix (if n (prefix-numeric-value n) 0))) | |
182 t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
183 (message "Displaying floats with %d digits after decimal" |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
184 (math-abs (nth 1 n))))) |
40785 | 185 |
186 (defun calc-sci-notation (n) | |
187 (interactive "P") | |
188 (calc-wrapper | |
189 (calc-change-mode 'calc-float-format | |
190 (setq n (list 'sci (if n (prefix-numeric-value n) 0))) | |
191 t) | |
192 (if (eq (nth 1 n) 0) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
193 (message "Displaying floats in scientific notation") |
40785 | 194 (if (> (nth 1 n) 0) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
195 (message "Displaying scientific notation with %d significant digits" |
40785 | 196 (nth 1 n)) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
197 (message "Displaying scientific notation with (precision%d)" |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
198 (nth 1 n)))))) |
40785 | 199 |
200 (defun calc-eng-notation (n) | |
201 (interactive "P") | |
202 (calc-wrapper | |
203 (calc-change-mode 'calc-float-format | |
204 (setq n (list 'eng (if n (prefix-numeric-value n) 0))) | |
205 t) | |
206 (if (eq (nth 1 n) 0) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
207 (message "Displaying floats in engineering notation") |
40785 | 208 (if (> (nth 1 n) 0) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
209 (message "Displaying engineering notation with %d significant digits" |
40785 | 210 (nth 1 n)) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
211 (message "Displaying engineering notation with (precision%d)" |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
212 (nth 1 n)))))) |
40785 | 213 |
214 | |
215 (defun calc-truncate-stack (n &optional rel) | |
216 (interactive "P") | |
217 (calc-wrapper | |
218 (let ((oldtop calc-stack-top) | |
219 (newtop calc-stack-top)) | |
220 (calc-record-undo (list 'set 'saved-stack-top calc-stack-top)) | |
221 (let ((calc-stack-top 0) | |
222 (nn (prefix-numeric-value n))) | |
223 (setq newtop | |
224 (if n | |
225 (progn | |
226 (if rel | |
227 (setq nn (+ oldtop nn)) | |
228 (if (< nn 0) | |
229 (setq nn (+ nn (calc-stack-size))) | |
230 (setq nn (1+ nn)))) | |
231 (if (< nn 1) | |
232 1 | |
233 (if (> nn (calc-stack-size)) | |
234 (calc-stack-size) | |
235 nn))) | |
236 (max 1 (calc-locate-cursor-element (point))))) | |
237 (if (= newtop oldtop) | |
238 () | |
239 (calc-pop-stack 1 oldtop t) | |
240 (calc-push-list '(top-of-stack) newtop) | |
241 (if calc-line-numbering | |
242 (calc-refresh)))) | |
243 (calc-record-undo (list 'set 'saved-stack-top 0)) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
244 (setq calc-stack-top newtop)))) |
40785 | 245 |
246 (defun calc-truncate-up (n) | |
247 (interactive "p") | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
248 (calc-truncate-stack n t)) |
40785 | 249 |
250 (defun calc-truncate-down (n) | |
251 (interactive "p") | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
252 (calc-truncate-stack (- n) t)) |
40785 | 253 |
254 (defun calc-display-raw (arg) | |
255 (interactive "P") | |
256 (calc-wrapper | |
257 (setq calc-display-raw (if calc-display-raw nil (if arg 0 t))) | |
258 (calc-do-refresh) | |
259 (if calc-display-raw | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
260 (message "Press d ' again to cancel \"raw\" display mode")))) |
40785 | 261 |
262 | |
263 | |
264 | |
265 ;;; Mode commands. | |
266 | |
47696
6e1c8f17ab33
(calc-save-modes): Remove `quiet' arg; Don't bind `executing-kbd-macro'.
Colin Walters <walters@gnu.org>
parents:
41268
diff
changeset
|
267 (defun calc-save-modes () |
40785 | 268 (interactive) |
269 (calc-wrapper | |
270 (let (pos | |
271 (vals (mapcar (function (lambda (v) (symbol-value (car v)))) | |
272 calc-mode-var-list))) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
273 (unless calc-settings-file |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
274 (error "No `calc-settings-file' specified")) |
40785 | 275 (set-buffer (find-file-noselect (substitute-in-file-name |
276 calc-settings-file))) | |
277 (goto-char (point-min)) | |
278 (if (and (search-forward ";;; Mode settings stored by Calc" nil t) | |
279 (progn | |
280 (beginning-of-line) | |
281 (setq pos (point)) | |
282 (search-forward "\n;;; End of mode settings" nil t))) | |
283 (progn | |
284 (beginning-of-line) | |
285 (forward-line 1) | |
286 (delete-region pos (point))) | |
287 (goto-char (point-max)) | |
288 (insert "\n\n") | |
289 (forward-char -1)) | |
290 (insert ";;; Mode settings stored by Calc on " (current-time-string) "\n") | |
291 (let ((list calc-mode-var-list)) | |
292 (while list | |
293 (let* ((v (car (car list))) | |
294 (def (nth 1 (car list))) | |
295 (val (car vals))) | |
296 (or (equal val def) | |
297 (progn | |
298 (insert "(setq " (symbol-name v) " ") | |
299 (if (and (or (listp val) | |
300 (symbolp val)) | |
301 (not (memq val '(nil t)))) | |
302 (insert "'")) | |
303 (insert (prin1-to-string val) ")\n")))) | |
304 (setq list (cdr list) | |
305 vals (cdr vals)))) | |
306 (run-hooks 'calc-mode-save-hook) | |
307 (insert ";;; End of mode settings\n") | |
62164
8a30a4431922
(calc-save-modes): Reset the modes list if Calc is in embedded mode.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59417
diff
changeset
|
308 (save-buffer) |
8a30a4431922
(calc-save-modes): Reset the modes list if Calc is in embedded mode.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59417
diff
changeset
|
309 (if calc-embedded-info |
8a30a4431922
(calc-save-modes): Reset the modes list if Calc is in embedded mode.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59417
diff
changeset
|
310 (calc-embedded-save-original-modes))))) |
40785 | 311 |
312 (defun calc-settings-file-name (name &optional arg) | |
40997
70241447c9ef
(calc-settings-file-name): Don't hardcode
Eli Zaretskii <eliz@gnu.org>
parents:
40785
diff
changeset
|
313 (interactive |
70241447c9ef
(calc-settings-file-name): Don't hardcode
Eli Zaretskii <eliz@gnu.org>
parents:
40785
diff
changeset
|
314 (list (read-file-name (format "Settings file name (normally %s): " |
59417
8cb9d2c5b48e
(calc-settings-file-name): Compare calc-settings-file to
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58665
diff
changeset
|
315 (abbreviate-file-name calc-settings-file))) |
40997
70241447c9ef
(calc-settings-file-name): Don't hardcode
Eli Zaretskii <eliz@gnu.org>
parents:
40785
diff
changeset
|
316 current-prefix-arg)) |
40785 | 317 (calc-wrapper |
318 (setq arg (if arg (prefix-numeric-value arg) 0)) | |
59417
8cb9d2c5b48e
(calc-settings-file-name): Compare calc-settings-file to
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58665
diff
changeset
|
319 (if (string-equal (file-name-nondirectory name) "") |
40785 | 320 (message "Calc settings file is \"%s\"" calc-settings-file) |
321 (if (< (math-abs arg) 2) | |
322 (let ((list calc-mode-var-list)) | |
323 (while list | |
324 (set (car (car list)) (nth 1 (car list))) | |
325 (setq list (cdr list))))) | |
326 (setq calc-settings-file name) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
327 (or (and |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
328 calc-settings-file |
59417
8cb9d2c5b48e
(calc-settings-file-name): Compare calc-settings-file to
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58665
diff
changeset
|
329 (equal user-init-file calc-settings-file) |
8cb9d2c5b48e
(calc-settings-file-name): Compare calc-settings-file to
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58665
diff
changeset
|
330 (> arg 0)) |
40785 | 331 (< arg 0) |
332 (load name t) | |
40997
70241447c9ef
(calc-settings-file-name): Don't hardcode
Eli Zaretskii <eliz@gnu.org>
parents:
40785
diff
changeset
|
333 (message "New file"))))) |
40785 | 334 |
335 (defun math-get-modes-vec () | |
336 (list 'vec | |
337 calc-internal-prec | |
338 calc-word-size | |
339 (calc-stack-size) | |
340 calc-number-radix | |
341 (+ (if (<= (nth 1 calc-float-format) 0) | |
342 (+ calc-internal-prec (nth 1 calc-float-format)) | |
343 (nth 1 calc-float-format)) | |
344 (cdr (assq (car calc-float-format) | |
345 '((float . 0) (sci . 10000) | |
346 (eng . 20000) (fix . 30000))))) | |
347 (cond ((eq calc-angle-mode 'rad) 2) | |
348 ((eq calc-angle-mode 'hms) 3) | |
349 (t 1)) | |
350 (if calc-symbolic-mode 1 0) | |
351 (if calc-prefer-frac 1 0) | |
352 (if (eq calc-complex-mode 'polar) 1 0) | |
353 (cond ((eq calc-matrix-mode 'scalar) 0) | |
354 ((eq calc-matrix-mode 'matrix) -2) | |
355 (calc-matrix-mode) | |
356 (t -1)) | |
357 (cond ((eq calc-simplify-mode 'none) -1) | |
358 ((eq calc-simplify-mode 'num) 0) | |
359 ((eq calc-simplify-mode 'binary) 2) | |
360 ((eq calc-simplify-mode 'alg) 3) | |
361 ((eq calc-simplify-mode 'ext) 4) | |
362 ((eq calc-simplify-mode 'units) 5) | |
363 (t 1)) | |
364 (cond ((eq calc-infinite-mode 1) 0) | |
365 (calc-infinite-mode 1) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
366 (t -1)))) |
40785 | 367 |
368 (defun calc-get-modes (n) | |
369 (interactive "P") | |
370 (calc-wrapper | |
371 (let ((modes (math-get-modes-vec))) | |
372 (calc-enter-result 0 "mode" | |
373 (if n | |
374 (if (and (>= (setq n (prefix-numeric-value n)) 1) | |
375 (< n (length modes))) | |
376 (nth n modes) | |
377 (error "Prefix out of range")) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
378 modes))))) |
40785 | 379 |
380 (defun calc-shift-prefix (arg) | |
381 (interactive "P") | |
382 (calc-wrapper | |
383 (setq calc-shift-prefix (if arg | |
384 (> (prefix-numeric-value arg) 0) | |
385 (not calc-shift-prefix))) | |
386 (calc-init-prefixes) | |
387 (message (if calc-shift-prefix | |
388 "Prefix keys are now case-insensitive" | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
389 "Prefix keys must be unshifted (except V, Z)")))) |
40785 | 390 |
391 (defun calc-mode-record-mode (n) | |
392 (interactive "P") | |
393 (calc-wrapper | |
394 (calc-change-mode 'calc-mode-save-mode | |
395 (cond ((null n) | |
396 (cond ((not calc-embedded-info) | |
397 (if (eq calc-mode-save-mode 'save) | |
398 'local 'save)) | |
399 ((eq calc-mode-save-mode 'local) 'edit) | |
400 ((eq calc-mode-save-mode 'edit) 'perm) | |
401 ((eq calc-mode-save-mode 'perm) 'global) | |
402 ((eq calc-mode-save-mode 'global) 'save) | |
403 ((eq calc-mode-save-mode 'save) nil) | |
404 ((eq calc-mode-save-mode nil) 'local))) | |
405 ((= (setq n (prefix-numeric-value n)) 0) nil) | |
406 ((= n 2) 'edit) | |
407 ((= n 3) 'perm) | |
408 ((= n 4) 'global) | |
409 ((= n 5) 'save) | |
410 (t 'local))) | |
65592
1038e6fc7f28
message format spec fixes, commit # 11
Deepak Goel <deego@gnufans.org>
parents:
64325
diff
changeset
|
411 (message "%s" |
1038e6fc7f28
message format spec fixes, commit # 11
Deepak Goel <deego@gnufans.org>
parents:
64325
diff
changeset
|
412 (cond ((and (eq calc-mode-save-mode 'local) calc-embedded-info) |
40785 | 413 "Recording mode changes with [calc-mode: ...]") |
414 ((eq calc-mode-save-mode 'edit) | |
415 "Recording mode changes with [calc-edit-mode: ...]") | |
416 ((eq calc-mode-save-mode 'perm) | |
417 "Recording mode changes with [calc-perm-mode: ...]") | |
418 ((eq calc-mode-save-mode 'global) | |
419 "Recording mode changes with [calc-global-mode: ...]") | |
420 ((eq calc-mode-save-mode 'save) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
421 (format "Recording mode changes in \"%s\"" |
40785 | 422 calc-settings-file)) |
423 (t | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
424 "Not recording mode changes permanently"))))) |
40785 | 425 |
426 (defun calc-total-algebraic-mode (flag) | |
427 (interactive "P") | |
428 (calc-wrapper | |
429 (if (eq calc-algebraic-mode 'total) | |
430 (calc-algebraic-mode nil) | |
431 (calc-change-mode '(calc-algebraic-mode calc-incomplete-algebraic-mode) | |
432 '(total nil)) | |
433 (use-local-map calc-alg-map) | |
434 (message | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
435 "All keys begin algebraic entry; use Meta (ESC) for Calc keys")))) |
40785 | 436 |
437 (defun calc-algebraic-mode (flag) | |
438 (interactive "P") | |
439 (calc-wrapper | |
440 (if flag | |
441 (calc-change-mode '(calc-algebraic-mode | |
442 calc-incomplete-algebraic-mode) | |
443 (list nil (not calc-incomplete-algebraic-mode))) | |
444 (calc-change-mode '(calc-algebraic-mode calc-incomplete-algebraic-mode) | |
445 (list (not calc-algebraic-mode) nil))) | |
446 (use-local-map calc-mode-map) | |
447 (message (if calc-algebraic-mode | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
448 "Numeric keys and ( and [ begin algebraic entry" |
40785 | 449 (if calc-incomplete-algebraic-mode |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
450 "Only ( and [ begin algebraic entry" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
451 "No keys except ' and $ begin algebraic entry"))))) |
40785 | 452 |
453 (defun calc-symbolic-mode (n) | |
454 (interactive "P") | |
455 (calc-wrapper | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
456 |
40785 | 457 (message (if (calc-change-mode 'calc-symbolic-mode n nil t) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
458 "Inexact computations like sqrt(2) are deferred" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
459 "Numerical computations are always done immediately")))) |
40785 | 460 |
461 (defun calc-infinite-mode (n) | |
462 (interactive "P") | |
463 (calc-wrapper | |
464 (if (eq n 0) | |
465 (progn | |
466 (calc-change-mode 'calc-infinite-mode 1) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
467 (message "Computations like 1 / 0 produce \"inf\"")) |
40785 | 468 (message (if (calc-change-mode 'calc-infinite-mode n nil t) |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
469 "Computations like 1 / 0 produce \"uinf\"" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
470 "Computations like 1 / 0 are left unsimplified"))))) |
40785 | 471 |
472 (defun calc-matrix-mode (arg) | |
473 (interactive "P") | |
474 (calc-wrapper | |
475 (calc-change-mode 'calc-matrix-mode | |
476 (cond ((eq arg 0) 'scalar) | |
477 ((< (prefix-numeric-value arg) 1) | |
478 (and (< (prefix-numeric-value arg) -1) 'matrix)) | |
479 (arg (prefix-numeric-value arg)) | |
480 ((eq calc-matrix-mode 'matrix) 'scalar) | |
481 ((eq calc-matrix-mode 'scalar) nil) | |
482 (t 'matrix))) | |
483 (if (integerp calc-matrix-mode) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
484 (message "Variables are assumed to be %dx%d matrices" |
40785 | 485 calc-matrix-mode calc-matrix-mode) |
486 (message (if (eq calc-matrix-mode 'matrix) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
487 "Variables are assumed to be matrices" |
40785 | 488 (if calc-matrix-mode |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
489 "Variables are assumed to be scalars (non-matrices)" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
490 "Variables are not assumed to be matrix or scalar")))))) |
40785 | 491 |
492 (defun calc-set-simplify-mode (mode arg msg) | |
493 (calc-change-mode 'calc-simplify-mode | |
494 (if arg | |
495 (and (> (prefix-numeric-value arg) 0) | |
496 mode) | |
497 (and (not (eq calc-simplify-mode mode)) | |
498 mode))) | |
499 (message (if (eq calc-simplify-mode mode) | |
500 msg | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
501 "Default simplifications enabled"))) |
40785 | 502 |
503 (defun calc-no-simplify-mode (arg) | |
504 (interactive "P") | |
505 (calc-wrapper | |
506 (calc-set-simplify-mode 'none arg | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
507 "All default simplifications are disabled"))) |
40785 | 508 |
509 (defun calc-num-simplify-mode (arg) | |
510 (interactive "P") | |
511 (calc-wrapper | |
512 (calc-set-simplify-mode 'num arg | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
513 "Default simplifications apply only if arguments are numeric"))) |
40785 | 514 |
515 (defun calc-default-simplify-mode (arg) | |
516 (interactive "p") | |
517 (cond ((= arg 1) | |
518 (calc-wrapper | |
519 (calc-set-simplify-mode | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
520 nil nil "Usual default simplifications are enabled"))) |
40785 | 521 ((= arg 0) (calc-num-simplify-mode 1)) |
522 ((< arg 0) (calc-no-simplify-mode 1)) | |
523 ((= arg 2) (calc-bin-simplify-mode 1)) | |
524 ((= arg 3) (calc-alg-simplify-mode 1)) | |
525 ((= arg 4) (calc-ext-simplify-mode 1)) | |
526 ((= arg 5) (calc-units-simplify-mode 1)) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
527 (t (error "Prefix argument out of range")))) |
40785 | 528 |
529 (defun calc-bin-simplify-mode (arg) | |
530 (interactive "P") | |
531 (calc-wrapper | |
532 (calc-set-simplify-mode 'binary arg | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
533 (format "Binary simplification occurs by default (word size=%d)" |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
534 calc-word-size)))) |
40785 | 535 |
536 (defun calc-alg-simplify-mode (arg) | |
537 (interactive "P") | |
538 (calc-wrapper | |
539 (calc-set-simplify-mode 'alg arg | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
540 "Algebraic simplification occurs by default"))) |
40785 | 541 |
542 (defun calc-ext-simplify-mode (arg) | |
543 (interactive "P") | |
544 (calc-wrapper | |
545 (calc-set-simplify-mode 'ext arg | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
546 "Extended algebraic simplification occurs by default"))) |
40785 | 547 |
548 (defun calc-units-simplify-mode (arg) | |
549 (interactive "P") | |
550 (calc-wrapper | |
551 (calc-set-simplify-mode 'units arg | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
552 "Units simplification occurs by default"))) |
40785 | 553 |
554 (defun calc-auto-recompute (arg) | |
555 (interactive "P") | |
556 (calc-wrapper | |
557 (calc-change-mode 'calc-auto-recompute arg nil t) | |
558 (calc-refresh-evaltos) | |
559 (message (if calc-auto-recompute | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
560 "Automatically recomputing `=>' forms when necessary" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
561 "Not recomputing `=>' forms automatically")))) |
40785 | 562 |
563 (defun calc-working (n) | |
564 (interactive "P") | |
565 (calc-wrapper | |
566 (cond ((consp n) | |
567 (calc-pop-push-record 0 "work" | |
568 (cond ((eq calc-display-working-message t) 1) | |
569 (calc-display-working-message 2) | |
570 (t 0)))) | |
571 ((eq n 2) (calc-change-mode 'calc-display-working-message 'lots)) | |
572 ((eq n 0) (calc-change-mode 'calc-display-working-message nil)) | |
573 ((eq n 1) (calc-change-mode 'calc-display-working-message t))) | |
574 (cond ((eq calc-display-working-message t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
575 (message "\"Working...\" messages enabled")) |
40785 | 576 (calc-display-working-message |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
577 (message "Detailed \"Working...\" messages enabled")) |
40785 | 578 (t |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
579 (message "\"Working...\" messages disabled"))))) |
40785 | 580 |
581 (defun calc-always-load-extensions () | |
582 (interactive) | |
583 (calc-wrapper | |
584 (if (setq calc-always-load-extensions (not calc-always-load-extensions)) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
585 (message "Always loading extensions package") |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
586 (message "Loading extensions package on demand only")))) |
40785 | 587 |
588 | |
589 (defun calc-matrix-left-justify () | |
590 (interactive) | |
591 (calc-wrapper | |
592 (calc-change-mode 'calc-matrix-just nil t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
593 (message "Matrix elements will be left-justified in columns"))) |
40785 | 594 |
595 (defun calc-matrix-center-justify () | |
596 (interactive) | |
597 (calc-wrapper | |
598 (calc-change-mode 'calc-matrix-just 'center t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
599 (message "Matrix elements will be centered in columns"))) |
40785 | 600 |
601 (defun calc-matrix-right-justify () | |
602 (interactive) | |
603 (calc-wrapper | |
604 (calc-change-mode 'calc-matrix-just 'right t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
605 (message "Matrix elements will be right-justified in columns"))) |
40785 | 606 |
607 (defun calc-full-vectors (n) | |
608 (interactive "P") | |
609 (calc-wrapper | |
610 (message (if (calc-change-mode 'calc-full-vectors n t t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
611 "Displaying long vectors in full" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
612 "Displaying long vectors in [a, b, c, ..., z] notation")))) |
40785 | 613 |
614 (defun calc-full-trail-vectors (n) | |
615 (interactive "P") | |
616 (calc-wrapper | |
617 (message (if (calc-change-mode 'calc-full-trail-vectors n nil t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
618 "Recording long vectors in full" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
619 "Recording long vectors in [a, b, c, ..., z] notation")))) |
40785 | 620 |
621 (defun calc-break-vectors (n) | |
622 (interactive "P") | |
623 (calc-wrapper | |
624 (message (if (calc-change-mode 'calc-break-vectors n t t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
625 "Displaying vector elements one-per-line" |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
626 "Displaying vector elements all on one line")))) |
40785 | 627 |
628 (defun calc-vector-commas () | |
629 (interactive) | |
630 (calc-wrapper | |
631 (if (calc-change-mode 'calc-vector-commas (if calc-vector-commas nil ",") t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
632 (message "Separating vector elements with \",\"") |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
633 (message "Separating vector elements with spaces")))) |
40785 | 634 |
635 (defun calc-vector-brackets () | |
636 (interactive) | |
637 (calc-wrapper | |
638 (if (calc-change-mode 'calc-vector-brackets | |
639 (if (equal calc-vector-brackets "[]") nil "[]") t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
640 (message "Surrounding vectors with \"[]\"") |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
641 (message "Not surrounding vectors with brackets")))) |
40785 | 642 |
643 (defun calc-vector-braces () | |
644 (interactive) | |
645 (calc-wrapper | |
646 (if (calc-change-mode 'calc-vector-brackets | |
647 (if (equal calc-vector-brackets "{}") nil "{}") t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
648 (message "Surrounding vectors with \"{}\"") |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
649 (message "Not surrounding vectors with brackets")))) |
40785 | 650 |
651 (defun calc-vector-parens () | |
652 (interactive) | |
653 (calc-wrapper | |
654 (if (calc-change-mode 'calc-vector-brackets | |
655 (if (equal calc-vector-brackets "()") nil "()") t) | |
41268
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
656 (message "Surrounding vectors with \"()\"") |
ca690490ae62
(calc-settings-file-name, calc-save-modes): Handle null
Colin Walters <walters@gnu.org>
parents:
41047
diff
changeset
|
657 (message "Not surrounding vectors with brackets")))) |
40785 | 658 |
659 (defun calc-matrix-brackets (arg) | |
660 (interactive "sCode letters (R, O, C, P): ") | |
661 (calc-wrapper | |
662 (let ((code (append (and (string-match "[rR]" arg) '(R)) | |
663 (and (string-match "[oO]" arg) '(O)) | |
664 (and (string-match "[cC]" arg) '(C)) | |
665 (and (string-match "[pP]" arg) '(P)))) | |
666 (bad (string-match "[^rRoOcCpP ]" arg))) | |
667 (if bad | |
668 (error "Unrecognized character: %c" (aref arg bad))) | |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
669 (calc-change-mode 'calc-matrix-brackets code t)))) |
40785 | 670 |
58665
eb797263e910
Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
57592
diff
changeset
|
671 (provide 'calc-mode) |
eb797263e910
Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
57592
diff
changeset
|
672 |
52401 | 673 ;;; arch-tag: ecc70eea-c712-43f2-9085-4205e58d6ddf |
41047
73f364fd8aaa
Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents:
40997
diff
changeset
|
674 ;;; calc-mode.el ends here |