diff options
Diffstat (limited to 'lisp/calc')
-rw-r--r-- | lisp/calc/calc-bin.el | 6 | ||||
-rw-r--r-- | lisp/calc/calc-comb.el | 58 | ||||
-rw-r--r-- | lisp/calc/calc-forms.el | 26 | ||||
-rw-r--r-- | lisp/calc/calc-funcs.el | 14 | ||||
-rw-r--r-- | lisp/calc/calc-mtx.el | 2 | ||||
-rw-r--r-- | lisp/calc/calc-store.el | 10 | ||||
-rw-r--r-- | lisp/calc/calc-units.el | 8 | ||||
-rw-r--r-- | lisp/calc/calc-yank.el | 56 | ||||
-rw-r--r-- | lisp/calc/calc.el | 107 | ||||
-rw-r--r-- | lisp/calc/calcalg3.el | 24 | ||||
-rw-r--r-- | lisp/calc/calccomp.el | 3 |
11 files changed, 193 insertions, 121 deletions
diff --git a/lisp/calc/calc-bin.el b/lisp/calc/calc-bin.el index e9083b84c61..aa10d55e52c 100644 --- a/lisp/calc/calc-bin.el +++ b/lisp/calc/calc-bin.el @@ -126,8 +126,8 @@ (defun calc-word-size (n) (interactive "P") (calc-wrapper - (or n (setq n (read-string (format "Binary word size: (default %d) " - calc-word-size)))) + (or n (setq n (read-string (format-prompt "Binary word size" + calc-word-size)))) (setq n (if (stringp n) (if (equal n "") calc-word-size @@ -403,7 +403,7 @@ (setq a (math-clip a w))) (let ((two-to-sizem1 (math-power-of-2 (1- w))) (sh (calcFunc-lsh a n w))) - (cond ((Math-natnum-lessp a two-to-sizem1) + (cond ((zerop (logand a two-to-sizem1)) sh) ((Math-lessp n (- 1 w)) (math-add (math-mul two-to-sizem1 2) -1)) diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el index d4562a0cc86..f7e29c6e52c 100644 --- a/lisp/calc/calc-comb.el +++ b/lisp/calc/calc-comb.el @@ -241,8 +241,8 @@ (calcFunc-gcd (math-neg a) b)) ((Math-looks-negp b) (calcFunc-gcd a (math-neg b))) - ((Math-zerop a) b) - ((Math-zerop b) a) + ((Math-zerop a) (math-abs b)) + ((Math-zerop b) (math-abs a)) ((and (Math-ratp a) (Math-ratp b)) (math-make-frac (math-gcd (if (eq (car-safe a) 'frac) (nth 1 a) a) @@ -292,15 +292,9 @@ (defconst math-small-factorial-table (vector 1 1 2 6 24 120 720 5040 40320 362880 3628800 39916800 - (math-read-number-simple "479001600") - (math-read-number-simple "6227020800") - (math-read-number-simple "87178291200") - (math-read-number-simple "1307674368000") - (math-read-number-simple "20922789888000") - (math-read-number-simple "355687428096000") - (math-read-number-simple "6402373705728000") - (math-read-number-simple "121645100408832000") - (math-read-number-simple "2432902008176640000"))) + 479001600 6227020800 87178291200 1307674368000 20922789888000 + 355687428096000 6402373705728000 121645100408832000 + 2432902008176640000)) (defun calcFunc-fact (n) ; [I I] [F F] [Public] (let (temp) @@ -445,12 +439,25 @@ (math-div (calcFunc-fact (math-float n)) (math-mul (calcFunc-fact m) (calcFunc-fact (math-sub n m)))))) - ((math-negp m) 0) - ((math-negp n) - (let ((val (calcFunc-choose (math-add (math-add n m) -1) m))) + ;; For the extension to negative integer arguments we follow + ;; M. J. Kronenburg, The Binomial Coefficient for Negative Arguments, + ;; arXiv:1105.3689v2 + ((and (math-negp n) (not (math-negp m))) + ;; n<0≤m: (n choose m) = (-1)^m (-n+m-1 choose m) + (let ((val (calcFunc-choose (math-add (math-sub m n) -1) m))) (if (math-evenp (math-trunc m)) val (math-neg val)))) + ((and (math-negp n) (math-num-integerp n)) + (if (math-lessp n m) + 0 + ;; m≤n<0: (n choose m) = (-1)^(n-m) (-m-1 choose n-m) + (let ((val (calcFunc-choose (math-sub (math-neg m) 1) + (math-sub n m)))) + (if (math-evenp (math-sub n m)) + val + (math-neg val))))) + ((math-negp m) 0) ((and (math-num-integerp n) (Math-lessp n m)) 0) @@ -467,20 +474,23 @@ (math-choose-float-iter tm n 1 1))))))) (defun math-choose-iter (m n i c) - (if (and (= (% i 5) 1) (> i 5)) + (while (<= i m) + (when (and (= (% i 5) 1) (> i 5)) (math-working (format "choose(%d)" (1- i)) c)) - (if (<= i m) - (math-choose-iter m (1- n) (1+ i) - (math-quotient (math-mul c n) i)) - c)) + (setq c (math-quotient (math-mul c n) i)) + (setq n (1- n)) + (setq i (1+ i))) + c) (defun math-choose-float-iter (count n i c) - (if (= (% i 5) 1) + (while (> count 0) + (when (= (% i 5) 1) (math-working (format "choose(%d)" (1- i)) c)) - (if (> count 0) - (math-choose-float-iter (1- count) (math-sub n 1) (1+ i) - (math-div (math-mul c n) i)) - c)) + (setq c (math-div (math-mul c n) i)) + (setq n (math-sub n 1)) + (setq i (1+ i)) + (setq count (1- count))) + c) ;;; Stirling numbers. diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index 5a8f0a38d24..a2f66968665 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el @@ -709,6 +709,10 @@ as measured in the number of days before December 31, 1 BC (Gregorian).") "The beginning of the Julian date calendar, as 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.") + (defun math-format-date-part (x) (cond ((stringp x) x) @@ -730,7 +734,8 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." (math-floor math-fd-date) math-julian-date-beginning-int))) ((eq x 'U) - (math-format-number (nth 1 (math-date-parts math-fd-date 719164)))) + (math-format-number (nth 1 (math-date-parts math-fd-date + math-unix-epoch)))) ((memq x '(IYYY Iww w)) (progn (or math-fd-iso-dt @@ -1173,7 +1178,7 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." (setq num (math-match-substring math-pd-str 0) math-pd-str (substring math-pd-str (match-end 0)) num (math-date-to-dt - (math-add 719164 + (math-add math-unix-epoch (math-div (math-read-number num) '(float 864 2)))) hour (nth 3 num) @@ -1434,11 +1439,11 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." (defun calcFunc-unixtime (date &optional zone) (if (math-realp date) (progn - (setq date (math-add 719163 (math-div date '(float 864 2)))) + (setq date (math-add math-unix-epoch (math-div date '(float 864 2)))) (list 'date (math-sub date (math-div (calcFunc-tzone zone date) '(float 864 2))))) (if (eq (car date) 'date) - (math-add (nth 1 (math-date-parts (nth 1 date) 719163)) + (math-add (nth 1 (math-date-parts (nth 1 date) math-unix-epoch)) (calcFunc-tzone zone date)) (math-reject-arg date 'datep)))) @@ -1870,8 +1875,8 @@ and ends on the last Sunday of October at 2 a.m." (and days (= day (car days)) (setq holiday t))) (let* ((weekdays (nth 3 math-holidays-cache)) - (weeks (1- (/ (+ day 6) 7))) - (wkday (- day 1 (* weeks 7)))) + (weeks (/ day 7)) + (wkday (mod day 7))) ; Day of week: 0=Sunday, 6=Saturday (setq delta (+ delta (* weeks (length weekdays)))) (while (and weekdays (< (car weekdays) wkday)) (setq weekdays (cdr weekdays) @@ -1905,14 +1910,15 @@ and ends on the last Sunday of October at 2 a.m." (setq delta (1+ delta))) (setq day (+ day delta))) (let* ((weekdays (nth 3 math-holidays-cache)) - (bweek (- 7 (length weekdays))) - (weeks (1- (/ (+ day (1- bweek)) bweek))) - (wkday (- day 1 (* weeks bweek))) + (bweek (- 7 (length weekdays))) ; Business days in a week, 1..7. + (weeks (/ day bweek)) ; Whole weeks. + (wkday (mod day bweek)) ; Business day in last week, 0..bweek-1 (w 0)) (setq day (+ day (* weeks (length weekdays)))) + ;; Add business days in the last week; `w' is weekday, 0..6. (while (if (memq w weekdays) (setq day (1+ day)) - (> (setq wkday (1- wkday)) 0)) + (>= (setq wkday (1- wkday)) 0)) (setq w (1+ w))) (let ((hours (nth 7 math-holidays-cache))) (if hours diff --git a/lisp/calc/calc-funcs.el b/lisp/calc/calc-funcs.el index add39b6f8b9..14f5e321080 100644 --- a/lisp/calc/calc-funcs.el +++ b/lisp/calc/calc-funcs.el @@ -816,25 +816,25 @@ (list (list 'frac -174611 - (math-read-number-simple "802857662698291200000")) + 802857662698291200000) (list 'frac 43867 - (math-read-number-simple "5109094217170944000")) + 5109094217170944000) (list 'frac -3617 - (math-read-number-simple "10670622842880000")) + 10670622842880000) (list 'frac 1 - (math-read-number-simple "74724249600")) + 74724249600) (list 'frac -691 - (math-read-number-simple "1307674368000")) + 1307674368000) (list 'frac 1 - (math-read-number-simple "47900160")) + 47900160) (list 'frac -1 - (math-read-number-simple "1209600")) + 1209600) (list 'frac 1 30240) diff --git a/lisp/calc/calc-mtx.el b/lisp/calc/calc-mtx.el index fe241b57c60..2850b33721b 100644 --- a/lisp/calc/calc-mtx.el +++ b/lisp/calc/calc-mtx.el @@ -275,7 +275,7 @@ in LUD decomposition." k (1+ k))) (setcar (nthcdr j (nth i lu)) sum) (let ((dum (math-lud-pivot-check sum))) - (if (Math-lessp big dum) + (if (or (math-zerop big) (Math-lessp big dum)) (setq big dum imax i))) (setq i (1+ i))) diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index 5282b834021..79e6cf5c00c 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -428,11 +428,11 @@ (defun calc-edit-variable (&optional var) (interactive) (calc-wrapper - (or var (setq var (calc-read-var-name - (if calc-last-edited-variable - (format "Edit (default %s): " - (calc-var-name calc-last-edited-variable)) - "Edit: ")))) + (unless var + (setq var (calc-read-var-name + (format-prompt "Edit" (and calc-last-edited-variable + (calc-var-name + calc-last-edited-variable)))))) (or var (setq var calc-last-edited-variable)) (if var (let* ((value (calc-var-value var))) diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index 7b86eb095b0..709c09ea099 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -37,14 +37,14 @@ ;;; Updated April 2002 by Jochen Küpper ;;; Updated August 2007, using -;;; CODATA (http://physics.nist.gov/cuu/Constants/index.html) -;;; NIST (http://physics.nist.gov/Pubs/SP811/appenB9.html) +;;; CODATA (https://physics.nist.gov/cuu/Constants/index.html) +;;; NIST (https://physics.nist.gov/Pubs/SP811/appenB9.html) ;;; ESUWM (Encyclopaedia of Scientific Units, Weights and ;;; Measures, by François Cardarelli) ;;; All conversions are exact unless otherwise noted. ;; CODATA values updated February 2016, using 2014 adjustment -;; http://arxiv.org/pdf/1507.07956.pdf +;; https://arxiv.org/pdf/1507.07956.pdf ;; Updated November 2018 for the redefinition of the SI ;; https://www.bipm.org/utils/en/pdf/CGPM/Draft-Resolution-A-EN.pdf @@ -59,7 +59,7 @@ ( mi "5280 ft" "Mile" ) ( au "149597870691. m" "Astronomical Unit" nil "149597870691 m (*)") - ;; (approx) NASA JPL (http://neo.jpl.nasa.gov/glossary/au.html) + ;; (approx) NASA JPL (https://neo.jpl.nasa.gov/glossary/au.html) ( lyr "c yr" "Light Year" ) ( pc "3.0856775854*10^16 m" "Parsec (**)" nil "3.0856775854 10^16 m (*)") ;; (approx) ESUWM diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el index f5150ca552c..690aaf2687f 100644 --- a/lisp/calc/calc-yank.el +++ b/lisp/calc/calc-yank.el @@ -150,34 +150,16 @@ ;; otherwise it just parses the yanked string. ;; Modified to use Emacs 19 extended concept of kill-ring. -- daveg 12/15/96 ;;;###autoload -(defun calc-yank (radix) - "Yank a value into the Calculator buffer. - -Valid numeric prefixes for RADIX: 0, 2, 6, 8 -No radix notation is prepended for any other numeric prefix. - -If RADIX is 2, prepend \"2#\" - Binary. -If RADIX is 8, prepend \"8#\" - Octal. -If RADIX is 0, prepend \"10#\" - Decimal. -If RADIX is 6, prepend \"16#\" - Hexadecimal. +(defun calc-yank-internal (radix thing-raw) + "Internal common implementation for yank functions. -If RADIX is a non-nil list (created using \\[universal-argument]), the user -will be prompted to enter the radix in the minibuffer. - -If RADIX is nil or if the yanked string already has a calc radix prefix, the -yanked string will be passed on directly to the Calculator buffer without any -alteration." - (interactive "P") +This function is used by both `calc-yank' and `calc-yank-mouse-primary'." (calc-wrapper (calc-pop-push-record-list 0 "yank" (let* (radix-num radix-notation valid-num-regexp - (thing-raw - (if (fboundp 'current-kill) - (current-kill 0 t) - (car kill-ring-yank-pointer))) (thing (if (or (null radix) ;; Match examples: -2#10, 10\n(10#10,01) @@ -232,6 +214,38 @@ alteration." val)) val)))))))) +;;;###autoload +(defun calc-yank-mouse-primary (radix) + "Yank the current primary selection into the Calculator buffer. +See `calc-yank' for details about RADIX." + (interactive "P") + (if (or select-enable-primary + select-enable-clipboard) + (calc-yank-internal radix (gui-get-primary-selection)) + ;; Yank from the kill ring. + (calc-yank radix))) + +;;;###autoload +(defun calc-yank (radix) + "Yank a value into the Calculator buffer. + +Valid numeric prefixes for RADIX: 0, 2, 6, 8 +No radix notation is prepended for any other numeric prefix. + +If RADIX is 2, prepend \"2#\" - Binary. +If RADIX is 8, prepend \"8#\" - Octal. +If RADIX is 0, prepend \"10#\" - Decimal. +If RADIX is 6, prepend \"16#\" - Hexadecimal. + +If RADIX is a non-nil list (created using \\[universal-argument]), the user +will be prompted to enter the radix in the minibuffer. + +If RADIX is nil or if the yanked string already has a calc radix prefix, the +yanked string will be passed on directly to the Calculator buffer without any +alteration." + (interactive "P") + (calc-yank-internal radix (current-kill 0 t))) + ;;; The Calc set- and get-register commands are modified versions of functions ;;; in register.el diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 648cb7bb807..bf8b006d7c6 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -884,6 +884,8 @@ Used by `calc-user-invocation'.") (defvar calc-load-hook nil "Hook run when calc.el is loaded.") +(make-obsolete-variable 'calc-load-hook + "use `with-eval-after-load' instead." "28.1") (defvar calc-window-hook nil "Hook called to create the Calc window.") @@ -1085,8 +1087,26 @@ Used by `calc-user-invocation'.") (append (where-is-internal 'delete-backward-char global-map) (where-is-internal 'backward-delete-char global-map) (where-is-internal 'backward-delete-char-untabify global-map) - '("\C-d")) - '("\177" "\C-d"))) + '("\177")) + '("\177"))) + +(mapc (lambda (x) + (ignore-errors + (define-key calc-digit-map x 'calcDigit-delchar) + (define-key calc-mode-map x 'calc-pop) + (define-key calc-mode-map + (if (and (vectorp x) (featurep 'xemacs)) + (if (= (length x) 1) + (vector (if (consp (aref x 0)) + (cons 'meta (aref x 0)) + (list 'meta (aref x 0)))) + "\e\C-d") + (vconcat "\e" x)) + 'calc-pop-above))) + (if calc-scan-for-dels + (append (where-is-internal 'delete-forward-char global-map) + '("\C-d")) + '("\C-d"))) (defvar calc-dispatch-map (let ((map (make-keymap))) @@ -1362,6 +1382,29 @@ Notations: 3.14e6 3.14 * 10^6 (set-keymap-parent map calc-mode-map) map)) +(defun calc--header-line (long short width &optional fudge) + "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 +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. + (setq header-line-format + (let* ((len-long (length long)) + (len-short (length short)) + (fudge (or fudge 0)) + ;; fudge for trail is: -3 (added to len-long) + ;; (width ) for trail + (factor (if (> width (+ len-long fudge)) len-long len-short)) + (size (max (/ (- width factor) 2) 0)) + (fill (make-string size ?-)) + (pre (replace-regexp-in-string ".$" " " fill)) + (post (replace-regexp-in-string "^." " " fill))) + (concat pre (if (= factor len-long) long short) post)))) + (define-derived-mode calc-trail-mode fundamental-mode "Calc Trail" "Calc Trail mode. This mode is used by the *Calc Trail* buffer, which records all results @@ -1376,9 +1419,9 @@ commands given here will actually operate on the *Calculator* stack." (setq buffer-read-only t) (make-local-variable 'overlay-arrow-position) (make-local-variable 'overlay-arrow-string) - (when (= (buffer-size) 0) - (let ((inhibit-read-only t)) - (insert (propertize "Emacs Calculator Trail\n" 'face 'italic))))) + (when calc-show-banner + (calc--header-line "Emacs Calculator Trail" "Calc Trail" + (/ (window-width) 3) -3))) (defun calc-create-buffer () "Create and initialize a buffer for the Calculator." @@ -1431,7 +1474,6 @@ commands given here will actually operate on the *Calculator* stack." (pop-to-buffer (current-buffer))))))) (with-current-buffer (calc-trail-buffer) (and calc-display-trail - (= (window-width) (frame-width)) (calc-trail-display 1 t))) (message "Welcome to the GNU Emacs Calculator! Press `?' or `h' for help, `q' to quit") (run-hooks 'calc-start-hook) @@ -1966,13 +2008,11 @@ See calc-keypad for details." (calc-any-evaltos nil)) (setq calc-any-selections nil) (erase-buffer) - (when calc-show-banner - (insert (propertize "--- Emacs Calculator Mode ---\n" - 'face 'italic))) + (when calc-show-banner + (calc--header-line "Emacs Calculator Mode" "Emacs Calc" + (* 2 (/ (window-width) 3)) -3)) (while thing (goto-char (point-min)) - (when calc-show-banner - (forward-line 1)) (insert (math-format-stack-value (car thing)) "\n") (setq thing (cdr thing))) (calc-renumber-stack) @@ -2056,7 +2096,6 @@ the United States." (eq (marker-buffer calc-trail-pointer) calc-trail-buffer)) (with-current-buffer calc-trail-buffer (goto-char (point-min)) - (forward-line 1) (setq calc-trail-pointer (point-marker)))) calc-trail-buffer) @@ -2124,10 +2163,8 @@ the United States." (if (derived-mode-p 'calc-trail-mode) (progn (beginning-of-line) - (if (bobp) - (forward-line 1) - (if (eobp) - (forward-line -1))) + (if (eobp) + (forward-line -1)) (if (or (bobp) (eobp)) (setq overlay-arrow-position nil) ; trail is empty (set-marker calc-trail-pointer (point) (current-buffer)) @@ -2141,7 +2178,7 @@ the United States." (if win (save-excursion (forward-line (/ (window-height win) 2)) - (forward-line (- 1 (window-height win))) + (forward-line (- 2 (window-height win))) (set-window-start win (point)) (set-window-point win (+ calc-trail-pointer 4)) (set-buffer calc-main-buffer) @@ -2341,7 +2378,6 @@ the United States." (defun calcDigit-key () (interactive) - (goto-char (point-max)) (if (or (and (memq last-command-event '(?+ ?-)) (> (buffer-size) 0) (/= (preceding-char) ?e)) @@ -2384,8 +2420,7 @@ the United States." (delete-char 1)) (if (looking-at "-") (delete-char 1) - (insert "-"))) - (goto-char (point-max))) + (insert "-")))) ((eq last-command-event ?p) (if (or (calc-minibuffer-contains ".*\\+/-.*") (calc-minibuffer-contains ".*mod.*") @@ -2427,7 +2462,7 @@ the United States." (if (and (memq last-command-event '(?@ ?o ?h ?\' ?m)) (string-match " " calc-hms-format)) (insert " ")) - (if (and (eq this-command last-command) + (if (and (memq last-command '(calcDigit-start calcDigit-key)) (eq last-command-event ?.)) (progn (require 'calc-ext) @@ -2438,17 +2473,9 @@ the United States." (setq calc-prev-prev-char calc-prev-char calc-prev-char last-command-event)) - (defun calcDigit-backspace () (interactive) - (goto-char (point-max)) - (cond ((calc-minibuffer-contains ".* \\+/- \\'") - (backward-delete-char 5)) - ((calc-minibuffer-contains ".* mod \\'") - (backward-delete-char 5)) - ((calc-minibuffer-contains ".* \\'") - (backward-delete-char 2)) - ((eq last-command 'calcDigit-start) + (cond ((eq last-command 'calcDigit-start) (erase-buffer)) (t (backward-delete-char 1))) (if (= (calc-minibuffer-size) 0) @@ -2923,6 +2950,20 @@ the United States." (- (- (nth 2 a) (nth 2 b)) ldiff)))) +(defun calcDigit-delchar () + (interactive) + (cond ((looking-at-p " \\+/- \\'") + (delete-char 5)) + ((looking-at-p " mod \\'") + (delete-char 5)) + ((looking-at-p " \\'") + (delete-char 2)) + ((eq last-command 'calcDigit-start) + (erase-buffer)) + (t (unless (eobp) (delete-char 1)))) + (when (= (calc-minibuffer-size) 0) + (setq last-command-event 13) + (calcDigit-nondigit))) (defvar math-comp-selected) @@ -3411,12 +3452,10 @@ See Info node `(calc)Defining Functions'." (defun calc-clear-unread-commands () (setq unread-command-events nil)) -(defcalcmodevar math-2-word-size - (math-read-number-simple "4294967296") +(defcalcmodevar math-2-word-size 4294967296 "Two to the power of `calc-word-size'.") -(defcalcmodevar math-half-2-word-size - (math-read-number-simple "2147483648") +(defcalcmodevar math-half-2-word-size 2147483648 "One-half of two to the power of `calc-word-size'.") (when calc-always-load-extensions diff --git a/lisp/calc/calcalg3.el b/lisp/calc/calcalg3.el index 67183fb754a..2d38c9c45bc 100644 --- a/lisp/calc/calcalg3.el +++ b/lisp/calc/calcalg3.el @@ -470,17 +470,19 @@ (setq defv (calc-invent-independent-variables nv))) (or defc (setq defc (calc-invent-parameter-variables nc defv))) - (let ((vars (read-string (format "Fitting variables (default %s; %s): " - (mapconcat 'symbol-name - (mapcar (function (lambda (v) - (nth 1 v))) - defv) - ",") - (mapconcat 'symbol-name - (mapcar (function (lambda (v) - (nth 1 v))) - defc) - ",")))) + (let ((vars (read-string (format-prompt + "Fitting variables" + (format "%s; %s" + (mapconcat 'symbol-name + (mapcar (function (lambda (v) + (nth 1 v))) + defv) + ",") + (mapconcat 'symbol-name + (mapcar (function (lambda (v) + (nth 1 v))) + defc) + ","))))) (coefs nil)) (setq vars (if (string-match "\\[" vars) (math-read-expr vars) diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index 0367c537b5a..1f3ae842638 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el @@ -1018,7 +1018,8 @@ (make-string (+ w 2) ?\_)) (list 'horiz (if (= h 1) - "V" + (if (char-displayable-p ?√) + "√" "V") (append (list 'vleft (1- a)) (make-list (1- h) " |") '("\\|"))) |