Commit 11c9343f authored by Stefan Monnier's avatar Stefan Monnier

calc.el, calc-(ext|poly), calccomp: Use lexical-binding

* lisp/calc/calc-ext.el: Use lexical-binding, silence warnings.
(calc-init-extensions): Remove a few functions which can't be called
directly since they depend on dynamically scoped vars.
(calc-embedded-quiet): Declare.
(math-defcache): Use 'declare'.
(math-normalize-a): Remove declaration.
(math-normalize-nonstandard): Receive 'a' as arg instead.
(math-defintegral): Use 'declare'.
(math-exp-pos, math-exp-old-pos, math-exp-keep-spaces, math-rb-h2)
(math-read-big-baseline, math-read-big-h2, math-read-big-err-msg)
(math-exp-token, math-expr-data, math-exp-str): Declare.
(math-map-tree, math-read-expr): Avoid dynvars as formal arguments.

* lisp/calc/calc-poly.el: Use lexical-binding, silence warnings.
Turn some comments into docstrings.
(math-poly-div): Avoid dynvars as formal arguments.
(math-poly-base-top-expr): Move declaration before first use.
(calcFunc-factors, math-factor-expr, math-factor-expr-try)
(calcFunc-factor): Avoid dynvars as formal arguments.

* lisp/calc/calc.el: Use lexical-binding, silence warnings.
(math-normalize-a): Remove.
(math-normalize): Use lexical var 'a' instead.
(math-svo-c): Remove.
(math-stack-value-offset): Pass 'c' explicitly as arg to
math-stack-value-offset-fancy instead.

* lisp/calc/calccomp.el: Use lexical-binding, silence warnings.
(math-svo-c): Remove.
(math-stack-value-offset-fancy): Use new arg 'c' instead.
(math-comp-to-string-flat): Avoid dynvars as formal arguments.
parent 336681f3
Pipeline #103 failed with stage
in 20 minutes and 59 seconds
;;; calc-ext.el --- various extension functions for Calc ;;; calc-ext.el --- various extension functions for Calc -*- lexical-binding:t -*-
;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc. ;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
(defvar calc-alg-map) (defvar calc-alg-map)
(defvar calc-alg-esc-map) (defvar calc-alg-esc-map)
;;; The following was made a function so that it could be byte-compiled. ;; The following was made a function so that it could be byte-compiled.
(defun calc-init-extensions () (defun calc-init-extensions ()
(define-key calc-mode-map ":" 'calc-fdiv) (define-key calc-mode-map ":" 'calc-fdiv)
...@@ -894,8 +894,8 @@ calcFunc-pcont calcFunc-pdeg calcFunc-pdiv calcFunc-pdivide ...@@ -894,8 +894,8 @@ calcFunc-pcont calcFunc-pdeg calcFunc-pdiv calcFunc-pdivide
calcFunc-pdivrem calcFunc-pgcd calcFunc-plead calcFunc-pprim calcFunc-pdivrem calcFunc-pgcd calcFunc-plead calcFunc-pprim
calcFunc-prem math-accum-factors math-atomic-factorp calcFunc-prem math-accum-factors math-atomic-factorp
math-div-poly-const math-div-thru math-expand-power math-expand-term math-div-poly-const math-div-thru math-expand-power math-expand-term
math-factor-contains math-factor-expr math-factor-expr-part math-factor-contains math-factor-expr
math-factor-expr-try math-factor-finish math-factor-poly-coefs math-factor-finish
math-factor-protect math-mul-thru math-padded-polynomial math-factor-protect math-mul-thru math-padded-polynomial
math-partial-fractions math-poly-degree math-poly-deriv-coefs math-partial-fractions math-poly-degree math-poly-deriv-coefs
math-poly-gcd-frac-list math-poly-modulus-rec math-ratpoly-p math-poly-gcd-frac-list math-poly-modulus-rec math-ratpoly-p
...@@ -984,8 +984,8 @@ calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer) ...@@ -984,8 +984,8 @@ calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer)
)) ))
(mapcar (function (lambda (x) (mapcar (function (lambda (x)
(mapcar (function (lambda (cmd) (mapcar (function (lambda (cmd) (autoload cmd (car x) nil t)))
(autoload cmd (car x) nil t))) (cdr x)))) (cdr x))))
'( '(
("calc-alg" calc-alg-evaluate calc-apart calc-collect calc-expand ("calc-alg" calc-alg-evaluate calc-apart calc-collect calc-expand
...@@ -1307,8 +1307,9 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1307,8 +1307,9 @@ calc-kill calc-kill-region calc-yank))))
(message "%s" (if msg (message "%s" (if msg
(concat group ": " msg ":" (concat group ": " msg ":"
(make-string (make-string
(- (apply 'max (mapcar 'length msgs)) (- (apply #'max (mapcar #'length msgs))
(length msg)) 32) (length msg))
?\s)
" [MORE]" " [MORE]"
(if key (if key
(concat " " (char-to-string key) (concat " " (char-to-string key)
...@@ -1334,6 +1335,8 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1334,6 +1335,8 @@ calc-kill calc-kill-region calc-yank))))
;;; General. ;;; General.
(defvar calc-embedded-quiet)
(defun calc-reset (arg) (defun calc-reset (arg)
(interactive "P") (interactive "P")
(setq arg (if arg (prefix-numeric-value arg) nil)) (setq arg (if arg (prefix-numeric-value arg) nil))
...@@ -1398,7 +1401,7 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1398,7 +1401,7 @@ calc-kill calc-kill-region calc-yank))))
(defun calc-scroll-up (n) (defun calc-scroll-up (n)
(interactive "P") (interactive "P")
(condition-case err (condition-case nil
(scroll-up (or n (/ (window-height) 2))) (scroll-up (or n (/ (window-height) 2)))
(error nil)) (error nil))
(if (pos-visible-in-window-p (max 1 (- (point-max) 2))) (if (pos-visible-in-window-p (max 1 (- (point-max) 2)))
...@@ -1657,7 +1660,7 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1657,7 +1660,7 @@ calc-kill calc-kill-region calc-yank))))
(let ((entries (calc-top-list n 1 'entry)) (let ((entries (calc-top-list n 1 'entry))
(calc-undo-list nil) (calc-redo-list nil)) (calc-undo-list nil) (calc-redo-list nil))
(calc-pop-stack n 1 t) (calc-pop-stack n 1 t)
(calc-push-list (mapcar 'car entries) (calc-push-list (mapcar #'car entries)
1 1
(mapcar (function (lambda (x) (nth 2 x))) (mapcar (function (lambda (x) (nth 2 x)))
entries))))))) entries)))))))
...@@ -1707,7 +1710,7 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1707,7 +1710,7 @@ calc-kill calc-kill-region calc-yank))))
(calc-pop-push-record-list 1 "eval" (calc-pop-push-record-list 1 "eval"
(math-evaluate-expr (calc-top (- n))) (math-evaluate-expr (calc-top (- n)))
(- n)) (- n))
(calc-pop-push-record-list n "eval" (mapcar 'math-evaluate-expr (calc-pop-push-record-list n "eval" (mapcar #'math-evaluate-expr
(calc-top-list n))))) (calc-top-list n)))))
(calc-handle-whys))) (calc-handle-whys)))
...@@ -1928,7 +1931,7 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -1928,7 +1931,7 @@ calc-kill calc-kill-region calc-yank))))
(calc-z-prefix-buf "") (calc-z-prefix-buf "")
(kmap (sort (copy-sequence (calc-user-key-map)) (kmap (sort (copy-sequence (calc-user-key-map))
(function (lambda (x y) (< (car x) (car y)))))) (function (lambda (x y) (< (car x) (car y))))))
(flags (apply 'logior (flags (apply #'logior
(mapcar (function (mapcar (function
(lambda (k) (lambda (k)
(calc-user-function-classify (car k)))) (calc-user-function-classify (car k))))
...@@ -2003,12 +2006,13 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -2003,12 +2006,13 @@ calc-kill calc-kill-region calc-yank))))
;;;; Caches. ;;;; Caches.
(defmacro math-defcache (name init form) (defmacro math-defcache (name init form)
(declare (indent 2) (debug (symbolp sexp form)))
(let ((cache-prec (intern (concat (symbol-name name) "-cache-prec"))) (let ((cache-prec (intern (concat (symbol-name name) "-cache-prec")))
(cache-val (intern (concat (symbol-name name) "-cache"))) (cache-val (intern (concat (symbol-name name) "-cache")))
(last-prec (intern (concat (symbol-name name) "-last-prec"))) (last-prec (intern (concat (symbol-name name) "-last-prec")))
(last-val (intern (concat (symbol-name name) "-last")))) (last-val (intern (concat (symbol-name name) "-last"))))
`(progn `(progn
; (defvar ,cache-prec ,(if init (math-numdigs (nth 1 init)) -100)) ;; (defvar ,cache-prec ,(if init (math-numdigs (nth 1 init)) -100))
(defvar ,cache-prec (cond (defvar ,cache-prec (cond
((consp ,init) (math-numdigs (nth 1 ,init))) ((consp ,init) (math-numdigs (nth 1 ,init)))
(,init (,init
...@@ -2037,7 +2041,6 @@ calc-kill calc-kill-region calc-yank)))) ...@@ -2037,7 +2041,6 @@ calc-kill calc-kill-region calc-yank))))
,cache-val)) ,cache-val))
,last-prec calc-internal-prec)) ,last-prec calc-internal-prec))
,last-val)))) ,last-val))))
(put 'math-defcache 'lisp-indent-hook 2)
;;; Betcha didn't know that pi = 16 atan(1/5) - 4 atan(1/239). [F] [Public] ;;; Betcha didn't know that pi = 16 atan(1/5) - 4 atan(1/239). [F] [Public]
(defconst math-approx-pi (defconst math-approx-pi
...@@ -2400,7 +2403,7 @@ If X is not an error form, return 1." ...@@ -2400,7 +2403,7 @@ If X is not an error form, return 1."
(list 'calcFunc-intv mask lo hi) (list 'calcFunc-intv mask lo hi)
(math-make-intv mask lo hi)))) (math-make-intv mask lo hi))))
((eq (car a) 'vec) ((eq (car a) 'vec)
(cons 'vec (mapcar 'math-normalize (cdr a)))) (cons 'vec (mapcar #'math-normalize (cdr a))))
((eq (car a) 'quote) ((eq (car a) 'quote)
(math-normalize (nth 1 a))) (math-normalize (nth 1 a)))
((eq (car a) 'special-const) ((eq (car a) 'special-const)
...@@ -2412,7 +2415,7 @@ If X is not an error form, return 1." ...@@ -2412,7 +2415,7 @@ If X is not an error form, return 1."
(math-normalize-logical-op a)) (math-normalize-logical-op a))
((memq (car a) '(calcFunc-lambda calcFunc-quote calcFunc-condition)) ((memq (car a) '(calcFunc-lambda calcFunc-quote calcFunc-condition))
(let ((calc-simplify-mode 'none)) (let ((calc-simplify-mode 'none))
(cons (car a) (mapcar 'math-normalize (cdr a))))) (cons (car a) (mapcar #'math-normalize (cdr a)))))
((eq (car a) 'calcFunc-evalto) ((eq (car a) 'calcFunc-evalto)
(setq a (or (nth 1 a) 0)) (setq a (or (nth 1 a) 0))
(or calc-refreshing-evaltos (or calc-refreshing-evaltos
...@@ -2435,27 +2438,25 @@ If X is not an error form, return 1." ...@@ -2435,27 +2438,25 @@ If X is not an error form, return 1."
;; The variable math-normalize-a is local to math-normalize in calc.el, ;; The variable math-normalize-a is local to math-normalize in calc.el,
;; but is used by math-normalize-nonstandard, which is called by ;; but is used by math-normalize-nonstandard, which is called by
;; math-normalize. ;; math-normalize.
(defvar math-normalize-a) (defun math-normalize-nonstandard (a)
(defun math-normalize-nonstandard ()
(if (consp calc-simplify-mode) (if (consp calc-simplify-mode)
(progn (progn
(setq calc-simplify-mode 'none (setq calc-simplify-mode 'none
math-simplify-only (car-safe (cdr-safe math-normalize-a))) math-simplify-only (car-safe (cdr-safe a)))
nil) nil)
(and (symbolp (car math-normalize-a)) (and (symbolp (car a))
(or (eq calc-simplify-mode 'none) (or (eq calc-simplify-mode 'none)
(and (eq calc-simplify-mode 'num) (and (eq calc-simplify-mode 'num)
(let ((aptr (setq math-normalize-a (let ((aptr (setq a
(cons (cons
(car math-normalize-a) (car a)
(mapcar 'math-normalize (mapcar #'math-normalize
(cdr math-normalize-a)))))) (cdr a))))))
(while (and aptr (math-constp (car aptr))) (while (and aptr (math-constp (car aptr)))
(setq aptr (cdr aptr))) (setq aptr (cdr aptr)))
aptr))) aptr)))
(cons (car math-normalize-a) (cons (car a)
(mapcar 'math-normalize (cdr math-normalize-a)))))) (mapcar #'math-normalize (cdr a))))))
;;; Normalize a bignum digit list by trimming high-end zeros. [L l] ;;; Normalize a bignum digit list by trimming high-end zeros. [L l]
...@@ -2808,7 +2809,7 @@ If X is not an error form, return 1." ...@@ -2808,7 +2809,7 @@ If X is not an error form, return 1."
x) x)
(if (Math-primp x) (if (Math-primp x)
x x
(cons (car x) (mapcar 'math-evaluate-expr-rec (cdr x)))))) (cons (car x) (mapcar #'math-evaluate-expr-rec (cdr x))))))
x)) x))
(defun math-any-floats (expr) (defun math-any-floats (expr)
...@@ -2822,9 +2823,10 @@ If X is not an error form, return 1." ...@@ -2822,9 +2823,10 @@ If X is not an error form, return 1."
(defvar math-mt-many nil) (defvar math-mt-many nil)
(defvar math-mt-func nil) (defvar math-mt-func nil)
(defun math-map-tree (math-mt-func mmt-expr &optional math-mt-many) (defun math-map-tree (func mmt-expr &optional many)
(or math-mt-many (setq math-mt-many 1000000)) (let ((math-mt-func func)
(math-map-tree-rec mmt-expr)) (math-mt-many (or many 1000000)))
(math-map-tree-rec mmt-expr)))
(defun math-map-tree-rec (mmt-expr) (defun math-map-tree-rec (mmt-expr)
(or (= math-mt-many 0) (or (= math-mt-many 0)
...@@ -2842,7 +2844,7 @@ If X is not an error form, return 1." ...@@ -2842,7 +2844,7 @@ If X is not an error form, return 1."
(<= math-mt-many 0)) (<= math-mt-many 0))
(setq mmt-done t) (setq mmt-done t)
(setq mmt-nextval (cons (car mmt-expr) (setq mmt-nextval (cons (car mmt-expr)
(mapcar 'math-map-tree-rec (mapcar #'math-map-tree-rec
(cdr mmt-expr)))) (cdr mmt-expr))))
(if (equal mmt-nextval mmt-expr) (if (equal mmt-nextval mmt-expr)
(setq mmt-done t) (setq mmt-done t)
...@@ -2867,6 +2869,7 @@ If X is not an error form, return 1." ...@@ -2867,6 +2869,7 @@ If X is not an error form, return 1."
(defvar math-integral-cache) (defvar math-integral-cache)
(defmacro math-defintegral (funcs &rest code) (defmacro math-defintegral (funcs &rest code)
(declare (indent 1) (debug (sexp body)))
(setq math-integral-cache nil) (setq math-integral-cache nil)
(cons 'progn (cons 'progn
(mapcar #'(lambda (func) (mapcar #'(lambda (func)
...@@ -2876,9 +2879,9 @@ If X is not an error form, return 1." ...@@ -2876,9 +2879,9 @@ If X is not an error form, return 1."
(list (list
#'(lambda (u) ,@code))))) #'(lambda (u) ,@code)))))
(if (symbolp funcs) (list funcs) funcs)))) (if (symbolp funcs) (list funcs) funcs))))
(put 'math-defintegral 'lisp-indent-hook 1)
(defmacro math-defintegral-2 (funcs &rest code) (defmacro math-defintegral-2 (funcs &rest code)
(declare (indent 1) (debug (sexp body)))
(setq math-integral-cache nil) (setq math-integral-cache nil)
(cons 'progn (cons 'progn
(mapcar #'(lambda (func) (mapcar #'(lambda (func)
...@@ -2887,7 +2890,6 @@ If X is not an error form, return 1." ...@@ -2887,7 +2890,6 @@ If X is not an error form, return 1."
(get ',func 'math-integral-2) (get ',func 'math-integral-2)
(list #'(lambda (u v) ,@code))))) (list #'(lambda (u v) ,@code)))))
(if (symbolp funcs) (list funcs) funcs)))) (if (symbolp funcs) (list funcs) funcs))))
(put 'math-defintegral-2 'lisp-indent-hook 1)
(defvar var-IntegAfterRules 'calc-IntegAfterRules) (defvar var-IntegAfterRules 'calc-IntegAfterRules)
...@@ -3097,9 +3099,16 @@ If X is not an error form, return 1." ...@@ -3097,9 +3099,16 @@ If X is not an error form, return 1."
;;; Expression parsing. ;;; Expression parsing.
(defvar math-expr-data) (defvar math-expr-data)
(defvar math-exp-pos)
(defvar math-exp-old-pos)
(defvar math-exp-keep-spaces)
(defvar math-exp-token)
(defvar math-expr-data)
(defvar math-exp-str)
(defun math-read-expr (math-exp-str) (defun math-read-expr (str)
(let ((math-exp-pos 0) (let ((math-exp-pos 0)
(math-exp-str str)
(math-exp-old-pos 0) (math-exp-old-pos 0)
(math-exp-keep-spaces nil) (math-exp-keep-spaces nil)
math-exp-token math-expr-data) math-exp-token math-expr-data)
...@@ -3138,6 +3147,10 @@ If X is not an error form, return 1." ...@@ -3138,6 +3147,10 @@ If X is not an error form, return 1."
;;; They said it couldn't be done... ;;; They said it couldn't be done...
(defvar math-read-big-baseline)
(defvar math-read-big-h2)
(defvar math-read-big-err-msg)
(defun math-read-big-expr (str) (defun math-read-big-expr (str)
(and (> (length calc-left-label) 0) (and (> (length calc-left-label) 0)
(string-match (concat "^" (regexp-quote calc-left-label)) str) (string-match (concat "^" (regexp-quote calc-left-label)) str)
...@@ -3179,6 +3192,8 @@ If X is not an error form, return 1." ...@@ -3179,6 +3192,8 @@ If X is not an error form, return 1."
'(error 0 "Syntax error")) '(error 0 "Syntax error"))
(math-read-expr str))))) (math-read-expr str)))))
(defvar math-rb-h2)
(defun math-read-big-bigp (math-read-big-lines) (defun math-read-big-bigp (math-read-big-lines)
(and (cdr math-read-big-lines) (and (cdr math-read-big-lines)
(let ((matrix nil) (let ((matrix nil)
......
This diff is collapsed.
This diff is collapsed.
;;; calccomp.el --- composition functions for Calc ;;; calccomp.el --- composition functions for Calc -*- lexical-binding:t -*-
;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc. ;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
...@@ -121,7 +121,8 @@ ...@@ -121,7 +121,8 @@
calc-lang-slash-idiv) calc-lang-slash-idiv)
(math-float (nth 1 aa)) (math-float (nth 1 aa))
(nth 1 aa)) (nth 1 aa))
(nth 2 aa)) prec)) (nth 2 aa))
prec))
(if (and (eq calc-language 'big) (if (and (eq calc-language 'big)
(= (length (car calc-frac-format)) 1)) (= (length (car calc-frac-format)) 1))
(let* ((aa (math-adjust-fraction a)) (let* ((aa (math-adjust-fraction a))
...@@ -202,8 +203,9 @@ ...@@ -202,8 +203,9 @@
(math-comp-comma-spc (or calc-vector-commas " ")) (math-comp-comma-spc (or calc-vector-commas " "))
(math-comp-comma (or calc-vector-commas "")) (math-comp-comma (or calc-vector-commas ""))
(math-comp-vector-prec (if (or (and calc-vector-commas (math-comp-vector-prec (if (or (and calc-vector-commas
(math-vector-no-parens a)) (math-vector-no-parens a))
(memq 'P calc-matrix-brackets)) 0 1000)) (memq 'P calc-matrix-brackets))
0 1000))
(math-comp-just (cond ((eq calc-matrix-just 'right) 'vright) (math-comp-just (cond ((eq calc-matrix-just 'right) 'vright)
((eq calc-matrix-just 'center) 'vcent) ((eq calc-matrix-just 'center) 'vcent)
(t 'vleft))) (t 'vleft)))
...@@ -803,8 +805,7 @@ ...@@ -803,8 +805,7 @@
( % . calcFunc-mod ) ( % . calcFunc-mod )
( ^ . calcFunc-pow ) ( ^ . calcFunc-pow )
( neg . calcFunc-neg ) ( neg . calcFunc-neg )
( | . calcFunc-vconcat )))) ( | . calcFunc-vconcat )))))
left right args)
(if func2 (if func2
(setq func (cdr func2))) (setq func (cdr func2)))
(if (setq func2 (rassq func math-expr-function-mapping)) (if (setq func2 (rassq func math-expr-function-mapping))
...@@ -858,7 +859,7 @@ ...@@ -858,7 +859,7 @@
(or (cdr (cdr a)) (or (cdr (cdr a))
(not (eq (car-safe (nth 1 a)) '*)))) (not (eq (car-safe (nth 1 a)) '*))))
(defun math-compose-matrix (a col cols base) (defun math-compose-matrix (a _col cols base)
(let ((col 0) (let ((col 0)
(res nil)) (res nil))
(while (<= (setq col (1+ col)) cols) (while (<= (setq col (1+ col)) cols)
...@@ -968,8 +969,8 @@ ...@@ -968,8 +969,8 @@
(and (memq (car a) '(^ calcFunc-subscr)) (and (memq (car a) '(^ calcFunc-subscr))
(math-tex-expr-is-flat (nth 1 a))))) (math-tex-expr-is-flat (nth 1 a)))))
(put 'calcFunc-log 'math-compose-big 'math-compose-log) (put 'calcFunc-log 'math-compose-big #'math-compose-log)
(defun math-compose-log (a prec) (defun math-compose-log (a _prec)
(and (= (length a) 3) (and (= (length a) 3)
(list 'horiz (list 'horiz
(list 'subscr "log" (list 'subscr "log"
...@@ -979,8 +980,8 @@ ...@@ -979,8 +980,8 @@
(math-compose-expr (nth 1 a) 1000) (math-compose-expr (nth 1 a) 1000)
")"))) ")")))
(put 'calcFunc-log10 'math-compose-big 'math-compose-log10) (put 'calcFunc-log10 'math-compose-big #'math-compose-log10)
(defun math-compose-log10 (a prec) (defun math-compose-log10 (a _prec)
(and (= (length a) 2) (and (= (length a) 2)
(list 'horiz (list 'horiz
(list 'subscr "log" "10") (list 'subscr "log" "10")
...@@ -988,8 +989,8 @@ ...@@ -988,8 +989,8 @@
(math-compose-expr (nth 1 a) 1000) (math-compose-expr (nth 1 a) 1000)
")"))) ")")))
(put 'calcFunc-deriv 'math-compose-big 'math-compose-deriv) (put 'calcFunc-deriv 'math-compose-big #'math-compose-deriv)
(put 'calcFunc-tderiv 'math-compose-big 'math-compose-deriv) (put 'calcFunc-tderiv 'math-compose-big #'math-compose-deriv)
(defun math-compose-deriv (a prec) (defun math-compose-deriv (a prec)
(when (= (length a) 3) (when (= (length a) 3)
(math-compose-expr (list '/ (math-compose-expr (list '/
...@@ -1003,8 +1004,8 @@ ...@@ -1003,8 +1004,8 @@
(nth 2 a)))) (nth 2 a))))
prec))) prec)))
(put 'calcFunc-sqrt 'math-compose-big 'math-compose-sqrt) (put 'calcFunc-sqrt 'math-compose-big #'math-compose-sqrt)
(defun math-compose-sqrt (a prec) (defun math-compose-sqrt (a _prec)
(when (= (length a) 2) (when (= (length a) 2)
(let* ((c (math-compose-expr (nth 1 a) 0)) (let* ((c (math-compose-expr (nth 1 a) 0))
(a (math-comp-ascent c)) (a (math-comp-ascent c))
...@@ -1024,8 +1025,8 @@ ...@@ -1024,8 +1025,8 @@
" " " "
c))))) c)))))
(put 'calcFunc-choose 'math-compose-big 'math-compose-choose) (put 'calcFunc-choose 'math-compose-big #'math-compose-choose)
(defun math-compose-choose (a prec) (defun math-compose-choose (a _prec)
(let ((a1 (math-compose-expr (nth 1 a) 0)) (let ((a1 (math-compose-expr (nth 1 a) 0))
(a2 (math-compose-expr (nth 2 a) 0))) (a2 (math-compose-expr (nth 2 a) 0)))
(list 'horiz (list 'horiz
...@@ -1035,7 +1036,7 @@ ...@@ -1035,7 +1036,7 @@
a1 " " a2) a1 " " a2)
")"))) ")")))
(put 'calcFunc-integ 'math-compose-big 'math-compose-integ) (put 'calcFunc-integ 'math-compose-big #'math-compose-integ)
(defun math-compose-integ (a prec) (defun math-compose-integ (a prec)
(and (memq (length a) '(3 5)) (and (memq (length a) '(3 5))
(eq (car-safe (nth 2 a)) 'var) (eq (car-safe (nth 2 a)) 'var)
...@@ -1072,7 +1073,7 @@ ...@@ -1072,7 +1073,7 @@
(list 'horiz " d" var)) (list 'horiz " d" var))
(if parens ")" ""))))) (if parens ")" "")))))
(put 'calcFunc-sum 'math-compose-big 'math-compose-sum) (put 'calcFunc-sum 'math-compose-big #'math-compose-sum)
(defun math-compose-sum (a prec) (defun math-compose-sum (a prec)
(and (memq (length a) '(3 5 6)) (and (memq (length a) '(3 5 6))
(let* ((expr (math-compose-expr (nth 1 a) 185)) (let* ((expr (math-compose-expr (nth 1 a) 185))
...@@ -1097,7 +1098,7 @@ ...@@ -1097,7 +1098,7 @@
expr expr
(if (memq prec '(180 201)) ")" ""))))) (if (memq prec '(180 201)) ")" "")))))
(put 'calcFunc-prod 'math-compose-big 'math-compose-prod) (put 'calcFunc-prod 'math-compose-big #'math-compose-prod)
(defun math-compose-prod (a prec) (defun math-compose-prod (a prec)
(and (memq (length a) '(3 5 6)) (and (memq (length a) '(3 5 6))
(let* ((expr (math-compose-expr (nth 1 a) 198)) (let* ((expr (math-compose-expr (nth 1 a) 198))
...@@ -1124,12 +1125,11 @@ ...@@ -1124,12 +1125,11 @@
;; The variables math-svo-c, math-svo-wid and math-svo-off are local ;; The variables math-svo-c, math-svo-wid and math-svo-off are local
;; to math-stack-value-offset in calc.el, but are used by ;; to math-stack-value-offset in calc.el, but are used by
;; math-stack-value-offset-fancy, which is called by math-stack-value-offset.. ;; math-stack-value-offset-fancy, which is called by math-stack-value-offset..
(defvar math-svo-c)
(defvar math-svo-wid) (defvar math-svo-wid)
(defvar math-svo-off) (defvar math-svo-off)
(defun math-stack-value-offset-fancy () (defun math-stack-value-offset-fancy (c)
(let ((cwid (+ (math-comp-width math-svo-c)))) (let ((cwid (+ (math-comp-width c))))
(cond ((eq calc-display-just 'right) (cond ((eq calc-display-just 'right)
(if calc-display-origin (if calc-display-origin
(setq math-svo-wid (max calc-display-origin 5)) (setq math-svo-wid (max calc-display-origin 5))
...@@ -1215,7 +1215,7 @@ ...@@ -1215,7 +1215,7 @@
;; which are called by math-comp-to-string-flat. ;; which are called by math-comp-to-string-flat.
(defvar math-comp-pos) (defvar math-comp-pos)
(defun math-comp-to-string-flat (c math-comp-full-width) (defun math-comp-to-string-flat (c full-width)
(if math-comp-sel-hpos (if math-comp-sel-hpos
(let ((math-comp-pos 0)) (let ((math-comp-pos 0))
(math-comp-sel-flat-term c)) (math-comp-sel-flat-term c))
...@@ -1224,6 +1224,7 @@ ...@@ -1224,6 +1224,7 @@
(math-comp-pos 0) (math-comp-pos 0)
(math-comp-margin 0) (math-comp-margin 0)
(math-comp-highlight (and math-comp-selected calc-show-selections)) (math-comp-highlight (and math-comp-selected calc-show-selections))
(math-comp-full-width full-width)
(math-comp-level -1)) (math-comp-level -1))
(math-comp-to-string-flat-term '(set -1 0)) (math-comp-to-string-flat-term '(set -1 0))
(math-comp-to-string-flat-term c) (math-comp-to-string-flat-term c)
...@@ -1387,7 +1388,7 @@ ...@@ -1387,7 +1388,7 @@
(defvar math-comp-hpos) (defvar math-comp-hpos)
(defvar math-comp-vpos) (defvar math-comp-vpos)
(defun math-comp-simplify (c full-width) (defun math-comp-simplify (c _full-width)
(let ((math-comp-buf (list "")) (let ((math-comp-buf (list ""))
(math-comp-base 0) (math-comp-base 0)
(math-comp-hgt 1) (math-comp-hgt 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment