diff options
Diffstat (limited to 'lisp/calc')
-rw-r--r-- | lisp/calc/calc-aent.el | 9 | ||||
-rw-r--r-- | lisp/calc/calc-bin.el | 2 | ||||
-rw-r--r-- | lisp/calc/calc-ext.el | 8 | ||||
-rw-r--r-- | lisp/calc/calc-forms.el | 17 | ||||
-rw-r--r-- | lisp/calc/calc-graph.el | 37 | ||||
-rw-r--r-- | lisp/calc/calc-help.el | 3 | ||||
-rw-r--r-- | lisp/calc/calc-keypd.el | 2 | ||||
-rw-r--r-- | lisp/calc/calc-lang.el | 8 | ||||
-rw-r--r-- | lisp/calc/calc-map.el | 2 | ||||
-rw-r--r-- | lisp/calc/calc-math.el | 5 | ||||
-rw-r--r-- | lisp/calc/calc-menu.el | 2 | ||||
-rw-r--r-- | lisp/calc/calc-misc.el | 3 | ||||
-rw-r--r-- | lisp/calc/calc-poly.el | 2 | ||||
-rw-r--r-- | lisp/calc/calc-prog.el | 27 | ||||
-rw-r--r-- | lisp/calc/calc-store.el | 2 | ||||
-rw-r--r-- | lisp/calc/calc-units.el | 43 | ||||
-rw-r--r-- | lisp/calc/calc.el | 91 | ||||
-rw-r--r-- | lisp/calc/calcalg2.el | 6 | ||||
-rw-r--r-- | lisp/calc/calcalg3.el | 8 |
19 files changed, 130 insertions, 147 deletions
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 1e31c3cadc0..52c024865a7 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -49,7 +49,7 @@ (declare-function math-to-percentsigns "calccomp" (x)) (defvar calc-quick-calc-history nil - "The history list for quick-calc.") + "The history list for `quick-calc'.") ;;;###autoload (defun calc-do-quick-calc (&optional insert) @@ -537,8 +537,7 @@ The value t means abort and give an error message.") ("₋" "-") ; - ("₍" "(") ; ( ("₎" ")")) ; ) - "A list whose elements (old new) indicate replacements to make -in Calc algebraic input.") + "A list indicating replacements to make in Calc algebraic input.") (defvar math-read-superscripts "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ" ; 0123456789+-()ni @@ -1139,7 +1138,7 @@ If the current Calc language does not use placeholders, return nil." 0) (setq sym (intern (substring (symbol-name sym) 1)))) - (or (string-match "-" (symbol-name sym)) + (or (string-search "-" (symbol-name sym)) (setq sym (intern (concat "calcFunc-" (symbol-name sym)))))) @@ -1149,7 +1148,7 @@ If the current Calc language does not use placeholders, return nil." (let ((val (list 'var (intern (math-remove-dashes (symbol-name sym))) - (if (string-match "-" (symbol-name sym)) + (if (string-search "-" (symbol-name sym)) sym (intern (concat "var-" (symbol-name sym))))))) diff --git a/lisp/calc/calc-bin.el b/lisp/calc/calc-bin.el index 503ed777029..a1f4ca43e71 100644 --- a/lisp/calc/calc-bin.el +++ b/lisp/calc/calc-bin.el @@ -202,7 +202,7 @@ (defun math-power-of-2 (n) ; [I I] [Public] (if (natnump n) (ash 1 n) - (error "argument must be a natural number"))) + (error "Argument must be a natural number"))) (defun math-integer-log2 (n) ; [I I] [Public] (and (natnump n) diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index e85ecf03906..dbe2f689d85 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -3088,7 +3088,7 @@ If X is not an error form, return 1." (math-read-big-err-msg nil) math-read-big-baseline math-read-big-h2 new-pos p) - (while (setq new-pos (string-match "\n" str pos)) + (while (setq new-pos (string-search "\n" str pos)) (setq math-read-big-lines (cons (substring str pos new-pos) math-read-big-lines) pos (1+ new-pos))) @@ -3249,7 +3249,7 @@ If X is not an error form, return 1." (t (let ((str (math-format-flat-expr x 0)) (pos 0) p) - (or (string-match "\"" str) + (or (string-search "\"" str) (while (<= (setq p (+ pos w)) (length str)) (while (and (> (setq p (1- p)) pos) (not (= (aref str p) ? )))) @@ -3278,7 +3278,7 @@ If X is not an error form, return 1." (math-format-radix-float a prec)) (format "%d#%s" calc-number-radix (math-format-radix-float a prec))))) - (if (and prec (> prec 191) (string-match "\\*" str)) + (if (and prec (> prec 191) (string-search "*" str)) (concat "(" str ")") str)))) ((eq (car a) 'frac) @@ -3418,7 +3418,7 @@ If X is not an error form, return 1." ;;; Users can redefine this in their init files. (defvar calc-keypad-user-menu nil - "If non-nil, this describes an additional menu for calc-keypad. + "If non-nil, this describes an additional menu for `calc-keypad'. It should contain a list of three rows. Each row should be a list of six keys. Each key should be a list of a label string, plus a Calc command name spec. diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index ee53b94cd64..ce8e3579f48 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el @@ -703,16 +703,19 @@ in the Gregorian calendar." fmt)))) (defconst math-julian-date-beginning '(float 17214245 -1) - "The beginning of the Julian date calendar, -as measured in the number of days before December 31, 1 BC (Gregorian).") + "The beginning of the Julian date calendar. +This is measured in the number of days before December 31, 1 +BC (Gregorian).") (defconst math-julian-date-beginning-int 1721425 - "The beginning of the Julian date calendar, -as measured in the integer number of days before December 31, 1 BC (Gregorian).") + "The beginning of the Julian date calendar. +This is measured in the integer number of days before December +31, 1 BC (Gregorian).") (defconst math-unix-epoch 719163 - "The beginning of Unix time: days from December 31, 1 BC (Gregorian) -to Jan 1, 1970 AD.") + "The beginning of Unix time. +This is measured in the integer number of days from December 31, +1 BC (Gregorian) to Jan 1, 1970 AD.") (defun math-format-date-part (x) (cond ((stringp x) @@ -2238,7 +2241,7 @@ and ends on the last Sunday of October at 2 a.m." (if (eq (car-safe str2) 'error) str2 (append '(calcFunc-lambda) (cdr str1) (list str2))))) - (if (string-match "#" str) + (if (string-search "#" str) (let ((calc-hashes-used 0)) (and (setq str (math-read-expr str)) (if (eq (car-safe str) 'error) diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index 423d1e64126..7891e35c40f 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el @@ -391,6 +391,13 @@ ((>= calc-gnuplot-version 3) "dumb") (t "postscript")))) + (unless (equal device calc-graph-last-device) + (setq calc-graph-last-device device) + (unless (calc-gnuplot-command "set terminal" device) + ;; If gnuplot doesn't support the terminal, then set it + ;; to "dumb". + (calc-gnuplot-command "set terminal dumb") + (setq device "dumb"))) (if (equal device "dumb") (setq device (format "dumb %d %d" (1- (frame-width)) (1- (frame-height))))) @@ -404,10 +411,6 @@ (setq tempoutfile (calc-temp-file-name -1) output tempoutfile)) (setq output (eval output t))) - (or (equal device calc-graph-last-device) - (progn - (setq calc-graph-last-device device) - (calc-gnuplot-command "set terminal" device))) (or (equal output calc-graph-last-output) (progn (setq calc-graph-last-output output) @@ -1025,7 +1028,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (calc-pop-stack 1)))) (if (string-match "\\[.+\\]" range) (setq range (substring range 1 -1))) - (if (and (not (string-match ":" range)) + (if (and (not (string-search ":" range)) (or (string-match "," range) (string-match " " range))) (aset range (match-beginning 0) ?\:)) @@ -1400,17 +1403,17 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (or calc-graph-no-auto-view (sit-for 0)))) (defun calc-gnuplot-check-for-errors () - (if (save-excursion - (prog2 - (progn - (set-buffer calc-gnuplot-buffer) - (goto-char calc-gnuplot-last-error-pos)) - (re-search-forward "^[ \t]+\\^$" nil t) - (goto-char (point-max)) - (setq calc-gnuplot-last-error-pos (point-max)))) + (if (with-current-buffer calc-gnuplot-buffer + (goto-char calc-gnuplot-last-error-pos) + (prog1 + (re-search-forward "^[ \t]+\\^$" nil t) + (goto-char (point-max)) + (setq calc-gnuplot-last-error-pos (point-max)))) (calc-graph-view-trail))) (defun calc-gnuplot-command (&rest args) + "Send ARGS to Gnuplot. +Returns nil if Gnuplot signalled an error." (calc-graph-init) (let ((cmd (concat (mapconcat 'identity args " ") "\n"))) (or (calc-graph-w32-p) @@ -1428,9 +1431,11 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (or (calc-graph-w32-p) (accept-process-output (and (not calc-graph-no-wait) calc-gnuplot-process))) - (calc-gnuplot-check-for-errors) - (if (get-buffer-window calc-gnuplot-buffer) - (calc-graph-view-trail))))) + (prog1 + ;; Return nil if we got an error. + (not (calc-gnuplot-check-for-errors)) + (if (get-buffer-window calc-gnuplot-buffer) + (calc-graph-view-trail)))))) (defun calc-graph-init-buffers () (or (and calc-gnuplot-buffer diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index dd5063f27d5..8481d0b5e9d 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el @@ -111,9 +111,6 @@ C-w Describe how there is no warranty for Calc." (with-current-buffer "*Help*" (let ((inhibit-read-only t)) (goto-char (point-min)) - (when (search-forward "Major Mode Bindings:" nil t) - (delete-region (point-min) (point)) - (insert "Calc Mode Bindings:")) (when (search-forward "Global bindings:" nil t) (forward-line -1) (delete-region (point) (point-max))) diff --git a/lisp/calc/calc-keypd.el b/lisp/calc/calc-keypd.el index 1902a4f3f29..acbef27a1da 100644 --- a/lisp/calc/calc-keypd.el +++ b/lisp/calc/calc-keypd.el @@ -481,7 +481,7 @@ ":" (if (and (equal cmd "e") (or (not input) - (string-match + (string-search "#" input)) (> radix 14)) (format "*%d.^" radix) diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el index 0117f449dd5..aef3173f5c0 100644 --- a/lisp/calc/calc-lang.el +++ b/lisp/calc/calc-lang.el @@ -660,7 +660,7 @@ (setq math-exp-pos (match-end 0) math-exp-token 'punc math-expr-data "[") - (let ((right (string-match "}" math-exp-str math-exp-pos))) + (let ((right (string-search "}" math-exp-str math-exp-pos))) (and right (setq math-exp-str (copy-sequence math-exp-str)) (aset math-exp-str right ?\])))))))))) @@ -899,7 +899,7 @@ (setq math-exp-pos (match-end 0) math-exp-token 'punc math-expr-data "[") - (let ((right (string-match "}" math-exp-str math-exp-pos))) + (let ((right (string-search "}" math-exp-str math-exp-pos))) (and right (setq math-exp-str (copy-sequence math-exp-str)) (aset math-exp-str right ?\])))))))))) @@ -2342,7 +2342,7 @@ order to Calc's." (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t) (if (= (math-read-big-char widest v) ?\() (progn - (setq line (if (string-match "-" p) + (setq line (if (string-search "-" p) (intern p) (intern (concat "calcFunc-" p))) h (1+ widest) @@ -2362,7 +2362,7 @@ order to Calc's." (setq p (cons line (nreverse p)))) (setq p (list 'var (intern (math-remove-dashes p)) - (if (string-match "-" p) + (if (string-search "-" p) (intern p) (intern (concat "var-" p))))))) diff --git a/lisp/calc/calc-map.el b/lisp/calc/calc-map.el index 16a2bd89cac..d12d05f3055 100644 --- a/lisp/calc/calc-map.el +++ b/lisp/calc/calc-map.el @@ -139,7 +139,7 @@ (defvar calc-verify-arglist t) (defun calc-map-stack () - "This is meant to be called by calc-keypad mode." + "This is meant to be called by `calc-keypad' mode." (interactive) (let ((calc-verify-arglist nil)) (calc-unread-command ?\$) diff --git a/lisp/calc/calc-math.el b/lisp/calc/calc-math.el index 1c2e7bcf2bc..ba2b6b2ca9c 100644 --- a/lisp/calc/calc-math.el +++ b/lisp/calc/calc-math.el @@ -618,8 +618,9 @@ If this can't be done, return NIL." (defun math-nth-root-float (a nrf-n &optional guess) (math-inexact-result) (math-with-extra-prec 1 - (let ((math-nrf-nf (math-float nrf-n)) - (math-nrf-nfm1 (math-float (1- nrf-n)))) + (let ((math-nrf-n nrf-n) + (math-nrf-nf (math-float nrf-n)) + (math-nrf-nfm1 (math-float (1- nrf-n)))) (math-nth-root-float-iter a (or guess (math-make-float 1 (/ (+ (math-numdigs (nth 1 a)) diff --git a/lisp/calc/calc-menu.el b/lisp/calc/calc-menu.el index 516f62d7b63..eed20a89a47 100644 --- a/lisp/calc/calc-menu.el +++ b/lisp/calc/calc-menu.el @@ -19,6 +19,8 @@ ;;; Commentary: +;;; Code: + (defvar calc-arithmetic-menu (list "Arithmetic" (list "Basic" diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el index b573c53f418..c8394e8c2fa 100644 --- a/lisp/calc/calc-misc.el +++ b/lisp/calc/calc-misc.el @@ -102,8 +102,7 @@ Miscellaneous: 0 (zero) calc-reset. Reset Calc stack and modes to default state. Press `*' twice (`C-x * *') to turn Calc on or off using the same -Calc user interface as before (either C-x * C or C-x * K; initially C-x * C). -" +Calc user interface as before (either C-x * C or C-x * K; initially C-x * C)." (interactive "P") (calc-check-defines) (if calc-dispatch-help diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el index 77587cc4b86..5d74a8f106b 100644 --- a/lisp/calc/calc-poly.el +++ b/lisp/calc/calc-poly.el @@ -454,7 +454,7 @@ This returns only the remainder from the pseudo-division." (defun math-atomic-factorp (expr) - "Return true if is a factor containing no sums or quotients." + "Return non-nil if is a factor containing no sums or quotients." (cond ((eq (car-safe expr) '*) (and (math-atomic-factorp (nth 1 expr)) (math-atomic-factorp (nth 2 expr)))) diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index 4e27d7671e2..b381f8afcf9 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -124,7 +124,7 @@ (or (memq (car-safe (car-safe place)) '(error xxxerror)) (setq place (aref (nth 2 (nth 2 (symbol-function 'calc-do))) 27))) (or (memq (car (car place)) '(error xxxerror)) - (error "foo")) + (error "Foo")) (setcar (car place) 'xxxerror)) (error (error "The calc-do function has been modified; unable to patch")))) @@ -205,9 +205,8 @@ (progn (setq cmd-base-default (concat "User-" keyname)) (setq cmd (completing-read - (concat "Define M-x command name (default calc-" - cmd-base-default - "): ") + (format-prompt "Define M-x command name" + (concat "calc-" cmd-base-default)) obarray 'commandp nil (if (and odef (symbolp (cdr odef))) (symbol-name (cdr odef)) @@ -241,8 +240,8 @@ (setq func (concat "calcFunc-" (completing-read - (concat "Define algebraic function name (default " - cmd-base-default "): ") + (format-prompt "Define algebraic function name" + cmd-base-default) (mapcar (lambda (x) (substring x 9)) (all-completions "calcFunc-" obarray)) @@ -604,7 +603,7 @@ ((equal name "#") (search-backward "#") (error "Token `#' is reserved")) - ((and unquoted (string-match "#" name)) + ((and unquoted (string-search "#" name)) (error "Tokens containing `#' must be quoted")) ((not (string-match "[^ ]" name)) (search-backward "\"" nil t) @@ -802,8 +801,8 @@ (when match (kill-line 1) (setq line (concat line (substring curline 0 match)))) - (setq line (replace-regexp-in-string "SPC" " SPC " - (replace-regexp-in-string " " "" line))) + (setq line (string-replace "SPC" " SPC " + (string-replace " " "" line))) (insert line "\t\t\t") (if (> (current-column) 24) (delete-char -1)) @@ -830,7 +829,7 @@ (when match (kill-line 1) (setq line (concat line (substring curline 0 match)))) - (setq line (replace-regexp-in-string " " "" line)) + (setq line (string-replace " " "" line)) (insert cmdbeg " " line "\t\t\t") (if (> (current-column) 24) (delete-char -1)) @@ -857,7 +856,7 @@ (when match (kill-line 1) (setq line (concat line (substring curline 0 match)))) - (setq line (replace-regexp-in-string " " "" line)) + (setq line (string-replace " " "" line)) (insert line "\t\t\t") (if (> (current-column) 24) (delete-char -1)) @@ -1068,7 +1067,7 @@ Redefine the corresponding command." (insert (setq str (prin1-to-string (cons 'defun (cons cmd (cdr fcmd))))) "\n") - (or (and (string-match "\"" str) (not q-ok)) + (or (and (string-search "\"" str) (not q-ok)) (fill-region pt (point))) (indent-rigidly pt (point) 2) (delete-region pt (1+ pt)) @@ -1087,7 +1086,7 @@ Redefine the corresponding command." (cons 'defun (cons func (cdr ffunc))))) "\n") - (or (and (string-match "\"" str) (not q-ok)) + (or (and (string-search "\"" str) (not q-ok)) (fill-region pt (point))) (indent-rigidly pt (point) 2) (delete-region pt (1+ pt)) @@ -2132,7 +2131,7 @@ Redefine the corresponding command." (cdr prim)) ((memq exp math-exp-env) exp) - ((string-match "-" name) + ((string-search "-" name) exp) (t (intern (concat "var-" name)))))) diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index ee29c440fe4..b3968555b62 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -586,7 +586,7 @@ (defun calc-permanent-variable (&optional var) (interactive) (calc-wrapper - (or var (setq var (calc-read-var-name "Save variable (default all): "))) + (or var (setq var (calc-read-var-name (format-prompt "Save variable" "all")))) (let (calc-pv-pos) (and var (or (and (boundp var) (symbol-value var)) (error "No such variable"))) diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index c3adc3db02a..f6d749db117 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -406,7 +406,7 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).") If EXPR is nil, return nil." (if expr (let ((cexpr (math-compose-expr expr 0))) - (replace-regexp-in-string + (string-replace " / " "/" (if (stringp cexpr) cexpr @@ -486,18 +486,13 @@ If COMP or STD is non-nil, put that in the units table instead." (setq defunits (math-get-default-units expr)) (unless new-units (setq new-units - (read-string (concat + (read-string (format-prompt (if (and uoldname (not nouold)) (concat "Old units: " uoldname ", new units") "New units") - (if defunits - (concat - " (default " - defunits - "): ") - ": ")))) + defunits))) (if (and (string= new-units "") defunits) @@ -529,18 +524,11 @@ If COMP or STD is non-nil, put that in the units table instead." (calc-slow-wrapper (let* ((expr (calc-top-n 1))) (unless (math-units-in-expr-p expr t) - (error "No units in expression.")) + (error "No units in expression")) (let* ((old-units (math-extract-units expr)) (defunits (math-get-default-units expr)) units - (new-units - (read-string (concat "New units" - (if defunits - (concat - " (default " - defunits - "): ") - ": "))))) + (new-units (read-string (format-prompt "New units" defunits)))) (if (and (string= new-units "") defunits) @@ -596,19 +584,14 @@ If COMP or STD is non-nil, put that in the units table instead." (setq expr (math-mul expr uold))) (setq defunits (math-get-default-units expr)) (setq unew (or new-units - (completing-read - (concat - (if uoldname - (concat "Old temperature units: " - uoldname - ", new units") - "New temperature units") - (if defunits - (concat " (default " - defunits - "): ") - ": ")) - tempunits))) + (completing-read (format-prompt + (if uoldname + (concat "Old temperature units: " + uoldname + ", new units") + "New temperature units") + defunits) + tempunits))) (setq unew (math-read-expr (if (string= unew "") defunits unew))) (when (eq (car-safe unew) 'error) (error "Bad format in units expression: %s" (nth 2 unew))) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 1e7d5e7766c..bd4ec4ff2f0 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -139,6 +139,7 @@ ;;; Code: (require 'calc-macs) +(require 'rect) ;; Declare functions which are defined elsewhere. (declare-function calc-set-language "calc-lang" (lang &optional option no-refresh)) @@ -251,7 +252,7 @@ (defcustom calc-embedded-announce-formula "%Embed\n\\(% .*\n\\)*" - "A regular expression which is sure to be followed by a calc-embedded formula." + "A regular expression which is sure to be followed by a `calc-embedded' formula." :type '(regexp)) (defcustom calc-embedded-announce-formula-alist @@ -277,12 +278,12 @@ (defcustom calc-embedded-close-formula "\\'\\|\n$\\|\\$\\$?\\|\\\\]\\|^\\\\end[^{].*\n\\|^\\\\end{.*[^x]}.*\n\\|^@.*\n\\|^\\.EN.*\n\\|\\\\)\\|\n%\n\\|^\\.\\\\\"\n" - "Regexp for the closing delimiter of a formula used by calc-embedded." + "Regexp for the closing delimiter of a formula used by `calc-embedded'." :type '(regexp)) (defcustom calc-embedded-open-close-formula-alist nil - "Alist of major modes with pairs of formula delimiters used by calc-embedded." + "Alist of major modes with pairs of formula delimiters used by `calc-embedded'." :type '(alist :key-type (symbol :tag "Major mode") :value-type (list (regexp :tag "Opening formula delimiter") (regexp :tag "Closing formula delimiter")))) @@ -347,13 +348,13 @@ See calc-embedded-open-plain." (defcustom calc-embedded-open-mode "% " - "A string which should precede calc-embedded mode annotations. + "A string which should precede `calc-embedded' mode annotations. This is not required to be present for user-written mode annotations." :type '(string)) (defcustom calc-embedded-close-mode "\n" - "A string which should follow calc-embedded mode annotations. + "A string which should follow `calc-embedded' mode annotations. This is not required to be present for user-written mode annotations." :type '(string)) @@ -386,43 +387,34 @@ This is not required to be present for user-written mode annotations." :type '(string) :version "26.2") -(defcustom calc-gnuplot-plot-command - nil +(defcustom calc-gnuplot-plot-command nil "Name of command for displaying GNUPLOT output; %s = file name to print." :type '(choice (string) (sexp))) -(defcustom calc-gnuplot-print-command - "lp %s" +(defcustom calc-gnuplot-print-command "lp %s" "Name of command for printing GNUPLOT output; %s = file name to print." :type '(choice (string) (sexp))) -(defcustom calc-multiplication-has-precedence - t - "If non-nil, multiplication has precedence over division -in normal mode." +(defcustom calc-multiplication-has-precedence t + "If non-nil, multiplication has precedence over division in normal mode." :type 'boolean) -(defcustom calc-ensure-consistent-units - nil - "If non-nil, make sure new units are consistent with current units -when converting units." +(defcustom calc-ensure-consistent-units nil + "If non-nil, ensure new units are consistent with current units when converting." :version "24.3" :type 'boolean) -(defcustom calc-context-sensitive-enter - nil +(defcustom calc-context-sensitive-enter nil "If non-nil, the stack element under the cursor will be copied by `calc-enter' and deleted by `calc-pop'." :version "24.4" :type 'boolean) -(defcustom calc-undo-length - 100 +(defcustom calc-undo-length 100 "The number of undo steps that will be preserved when Calc is quit." :type 'integer) -(defcustom calc-highlight-selections-with-faces - nil +(defcustom calc-highlight-selections-with-faces nil "If non-nil, use a separate face to indicate selected sub-formulas. If option `calc-show-selections' is non-nil, then selected sub-formulas are shown by displaying the rest of the formula in `calc-nonselected-face'. @@ -431,14 +423,12 @@ by displaying the sub-formula in `calc-selected-face'." :version "24.1" :type 'boolean) -(defcustom calc-lu-field-reference - "20 uPa" +(defcustom calc-lu-field-reference "20 uPa" "The default reference level for logarithmic units (field)." :version "24.1" :type '(string)) -(defcustom calc-lu-power-reference - "mW" +(defcustom calc-lu-power-reference "mW" "The default reference level for logarithmic units (power)." :version "24.1" :type '(string)) @@ -477,11 +467,11 @@ This is 1 unless `calc-truncate-stack' has been used.") (defvar calc-display-sci-high 0 "Floating-point numbers with this positive exponent or higher above the -current precision are displayed in scientific notation in calc-mode.") +current precision are displayed in scientific notation in `calc-mode'.") (defvar calc-display-sci-low -3 "Floating-point numbers with this negative exponent or lower are displayed -scientific notation in calc-mode.") +scientific notation in `calc-mode'.") (defvar calc-digit-after-point nil "If t, display at least one digit after the decimal point, as in `12.0'. @@ -495,16 +485,16 @@ This setting only applies to floats in normal display mode.") "List of strings for Y prefix help.") (defvar calc-loaded-settings-file nil - "t if `calc-settings-file' has been loaded yet.") + "Return t if `calc-settings-file' has been loaded yet.") (defvar calc-mode-var-list '() "List of variables used in customizing GNU Calc.") (defmacro defcalcmodevar (var defval &optional doc) - "Declare VAR as a Calc variable, with default value DEFVAL -and doc-string DOC. + "Declare VAR as a Calc variable, with default value DEFVAL and doc-string DOC. The variable VAR will be added to `calc-mode-var-list'." + (declare (doc-string 3) (indent defun)) `(progn (defvar ,var ,defval ,doc) (add-to-list 'calc-mode-var-list (list (quote ,var) ,defval)))) @@ -742,7 +732,7 @@ If nil, symbolic math routines make no assumptions about variables.") "Initial height of Calculator window.") (defcalcmodevar calc-display-trail t - "If non-nil, M-x calc creates a window to display Calculator trail.") + "If non-nil, \\[calc] creates a window to display Calculator trail.") (defcalcmodevar calc-show-selections t "If non-nil, selected sub-formulas are shown by obscuring rest of formula. @@ -921,7 +911,7 @@ Used by `calc-user-invocation'.") (defvar calc-trail-pointer nil "The \"current\" entry in trail buffer.") (defvar calc-trail-overlay nil - "The value of overlay-arrow-string.") + "The value of `overlay-arrow-string'.") (defvar calc-undo-list nil "The list of previous operations for undo.") (defvar calc-redo-list nil @@ -960,7 +950,7 @@ Used by `calc-user-invocation'.") (defvar calc-lang-allow-percentsigns nil "A list of languages which allow percent signs in variable names.") (defvar calc-lang-c-type-hex nil - "Languages in which octal and hex numbers are written with leading 0 and 0x,") + "Languages in which octal and hex numbers are written with leading 0 and 0x.") (defvar calc-lang-brackets-are-subscripts nil "Languages in which subscripts are indicated by brackets.") (defvar calc-lang-parens-are-subscripts nil @@ -1310,8 +1300,7 @@ Notations: 3.14e6 3.14 * 10^6 <1 jan 91> Date form (enter using \\=' key) -\\{calc-mode-map} -" +\\{calc-mode-map}" (interactive) (mapc (lambda (v) ;; FIXME: Why (set-default v (symbol-value v)) ?!?!? @@ -1382,12 +1371,12 @@ Notations: 3.14e6 3.14 * 10^6 map)) (defun calc--header-line (long short width &optional fudge) - "Return a Calc header line appropriate for the buffer width. + "Return a Calc header line appropriate for the buffer WIDTH. LONG is a desired text for a wide window, SHORT is a desired abbreviated text, and width is the buffer width, which will be some fraction of the 'parent' window width (At the time of -writing, 2/3 for calc, 1/3 for trail). The optional FUDGE is a +writing, 2/3 for calc, 1/3 for trail). The optional FUDGE is a trial-and-error adjustment number for the edge-cases at the border of the two cases." ;; TODO: This could be called as part of a 'window-resize' hook. @@ -1409,7 +1398,7 @@ border of the two cases." This mode is used by the *Calc Trail* buffer, which records all results obtained by the GNU Emacs Calculator. -Calculator commands beginning with the `t' key are used to manipulate +Calculator commands beginning with the t key are used to manipulate the Trail. This buffer uses the same key map as the *Calculator* buffer; calculator @@ -1480,7 +1469,9 @@ See `window-dedicated-p' for what that means." (with-current-buffer (calc-trail-buffer) (and calc-display-trail (calc-trail-display 1 t))) - (message "Welcome to the GNU Emacs Calculator! Press `?' or `h' for help, `q' to quit") + (message (substitute-command-keys + (concat "Welcome to the GNU Emacs Calculator! \\<calc-mode-map>" + "Press \\[calc-help] or \\[calc-help-prefix] for help, \\[calc-quit] to quit"))) (run-hooks 'calc-start-hook) (and (windowp full-display) (window-point full-display) @@ -1500,7 +1491,7 @@ See `window-dedicated-p' for what that means." (calc nil t interactive)) (defun calc-same-interface (arg) - "Invoke the Calculator using the most recent interface (calc or calc-keypad)." + "Invoke the Calculator using the most recent interface (`calc' or `calc-keypad')." (interactive "P") (if (and (equal (buffer-name) "*Gnuplot Trail*") (> (recursion-depth) 0)) @@ -1577,7 +1568,7 @@ or a list containing a character position and an error message in string form." "Invoke the Calculator in \"visual keypad\" mode. This is most useful in the X window system. In this mode, click on the Calc \"buttons\" using the left mouse button. -Or, position the cursor manually and do M-x calc-keypad-press." +Or, position the cursor manually and do \\[calc-keypad-press]." (interactive "p") (require 'calc-ext) (calc-do-keypad calc-full-mode interactive)) @@ -2126,7 +2117,7 @@ the United States." (goto-char (point-max)) (cond ((null prefix) (insert " ")) ((and (> (length prefix) 4) - (string-match " " prefix 4)) + (string-search " " prefix 4)) (insert (substring prefix 0 4) " ")) (t (insert (format "%4s " prefix)))) (insert fval "\n") @@ -2469,7 +2460,7 @@ the United States." (calc-minibuffer-contains "[-+]?\\(.*\\+/- *\\|.*mod *\\)?\\([0-9]+\\.?0*[@oh] *\\)?\\([0-9]+\\.?0*['m] *\\)?[0-9]*\\(\\.?[0-9]*\\(e[-+]?[0-3]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?\\)?\\|[0-9]:\\([0-9]+:\\)?[0-9]*\\)?[\"s]?\\'")) (if (and (memq last-command-event '(?@ ?o ?h ?\' ?m)) - (string-match " " calc-hms-format)) + (string-search " " calc-hms-format)) (insert " ")) (if (and (memq last-command '(calcDigit-start calcDigit-key)) (eq last-command-event ?.)) @@ -3059,7 +3050,7 @@ the United States." (defun calc-count-lines (s) (let ((pos 0) (num 1)) - (while (setq pos (string-match "\n" s pos)) + (while (setq pos (string-search "\n" s pos)) (setq pos (1+ pos) num (1+ num))) num)) @@ -3388,7 +3379,9 @@ and all digits are kept, regardless of Calc's current precision." "Parse the region as a vector of numbers and push it on the Calculator stack." (interactive "r\nP") (require 'calc-ext) - (calc-do-grab-region top bot arg)) + (if rectangle-mark-mode + (calc-do-grab-rectangle top bot arg) + (calc-do-grab-region top bot arg))) ;;;###autoload (defun calc-grab-rectangle (top bot arg) @@ -3397,12 +3390,14 @@ and all digits are kept, regardless of Calc's current precision." (require 'calc-ext) (calc-do-grab-rectangle top bot arg)) +;;;###autoload (defun calc-grab-sum-down (top bot arg) "Parse a rectangle as a matrix of numbers and sum its columns." (interactive "r\nP") (require 'calc-ext) (calc-do-grab-rectangle top bot arg 'calcFunc-reduced)) +;;;###autoload (defun calc-grab-sum-across (top bot arg) "Parse a rectangle as a matrix of numbers and sum its rows." (interactive "r\nP") @@ -3444,7 +3439,7 @@ The prefix `calcFunc-' is added to the specified name to get the actual Lisp function name. See Info node `(calc)Defining Functions'." - (declare (doc-string 3)) ;; FIXME: Edebug spec? + (declare (doc-string 3) (indent defun)) ;; FIXME: Edebug spec? (require 'calc-ext) (math-do-defmath func args body)) diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 94b99aa29d8..8d93ae987a1 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el @@ -158,7 +158,7 @@ (calc-top-n 2) (calc-top-n 1))) (let ((var (if (and (string-match ",\\|[^ ] +[^ ]" var) - (not (string-match "\\[" var))) + (not (string-search "[" var))) (math-read-expr (concat "[" var "]")) (math-read-expr var)))) (if (eq (car-safe var) 'error) @@ -175,7 +175,7 @@ (calc-top-n 2) (calc-top-n 1))) (let ((var (if (and (string-match ",\\|[^ ] +[^ ]" var) - (not (string-match "\\[" var))) + (not (string-search "[" var))) (math-read-expr (concat "[" var "]")) (math-read-expr var)))) (if (eq (car-safe var) 'error) @@ -1028,7 +1028,7 @@ (fset 'calcFunc-integ math-old-integ)))) ;; See if the function is a symbolic derivative. - (and (string-match "'" (symbol-name (car expr))) + (and (string-search "'" (symbol-name (car expr))) (let ((name (symbol-name (car expr))) (p expr) (n 0) (which nil) (bad nil)) (while (setq n (1+ n) p (cdr p)) diff --git a/lisp/calc/calcalg3.el b/lisp/calc/calcalg3.el index ee3ae0a4c1f..a61cdb5d0e6 100644 --- a/lisp/calc/calcalg3.el +++ b/lisp/calc/calcalg3.el @@ -56,7 +56,7 @@ (calc-top-n 1) (calc-top-n 2))) (let ((var (if (and (string-match ",\\|[^ ] +[^ ]" var) - (not (string-match "\\[" var))) + (not (string-search "[" var))) (math-read-expr (concat "[" var "]")) (math-read-expr var)))) (if (eq (car-safe var) 'error) @@ -81,7 +81,7 @@ (calc-top-n 1) (calc-top-n 2))) (let ((var (if (and (string-match ",\\|[^ ] +[^ ]" var) - (not (string-match "\\[" var))) + (not (string-search "[" var))) (math-read-expr (concat "[" var "]")) (math-read-expr var)))) (if (eq (car-safe var) 'error) @@ -490,7 +490,7 @@ defc) ","))))) (coefs nil)) - (setq vars (if (string-match "\\[" vars) + (setq vars (if (string-search "[" vars) (math-read-expr vars) (math-read-expr (concat "[" vars "]")))) (if (eq (car-safe vars) 'error) @@ -1484,7 +1484,7 @@ h (cdr h))) (setq curh (math-div-float curh '(float 9 0)))) ss - (math-reject-arg nil (format "*Integral failed to converge")))))) + (math-reject-arg nil "*Integral failed to converge"))))) (defun math-ninteg-evaluate (expr x mode) |