aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2007-06-20 04:07:24 +0000
committerJay Belanger2007-06-20 04:07:24 +0000
commit515e955e0a0efea90913b8bca66923e34c8f925e (patch)
tree0e79f8500abc855dd017cd930ff607f735b27ffa
parent219513ac8838d885c1c31fb1ef2b5ead8a7302e7 (diff)
downloademacs-515e955e0a0efea90913b8bca66923e34c8f925e.tar.gz
emacs-515e955e0a0efea90913b8bca66923e34c8f925e.zip
(calc-multiplication-has-precendence): New variable.
(math-standard-ops,math-standard-ops-p,math-expr-ops): New functions. (math-expr-opers): Define using math-standard-ops rather than math-standard-opers.
-rw-r--r--lisp/calc/calc.el35
1 files changed, 32 insertions, 3 deletions
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 4ca5662afdc..df2ff08b552 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -401,6 +401,13 @@ This is not required to be present for user-written mode annotations."
401 :group 'calc 401 :group 'calc
402 :type '(choice (string) (sexp))) 402 :type '(choice (string) (sexp)))
403 403
404(defcustom calc-multiplication-has-precedence
405 t
406 "*If non-nil, multiplication has precedence over division
407in normal mode."
408 :group 'calc
409 :type 'boolean)
410
404(defvar calc-bug-address "jay.p.belanger@gmail.com" 411(defvar calc-bug-address "jay.p.belanger@gmail.com"
405 "Address of the maintainer of Calc, for use by `report-calc-bug'.") 412 "Address of the maintainer of Calc, for use by `report-calc-bug'.")
406 413
@@ -3467,8 +3474,6 @@ See calc-keypad for details."
3467 ( "!" calcFunc-fact 210 -1 ) 3474 ( "!" calcFunc-fact 210 -1 )
3468 ( "^" ^ 201 200 ) 3475 ( "^" ^ 201 200 )
3469 ( "**" ^ 201 200 ) 3476 ( "**" ^ 201 200 )
3470 ( "*" * 196 195 )
3471 ( "2x" * 196 195 )
3472 ( "/" / 190 191 ) 3477 ( "/" / 190 191 )
3473 ( "%" % 190 191 ) 3478 ( "%" % 190 191 )
3474 ( "\\" calcFunc-idiv 190 191 ) 3479 ( "\\" calcFunc-idiv 190 191 )
@@ -3492,7 +3497,31 @@ See calc-keypad for details."
3492 ( "::" calcFunc-condition 45 46 ) 3497 ( "::" calcFunc-condition 45 46 )
3493 ( "=>" calcFunc-evalto 40 41 ) 3498 ( "=>" calcFunc-evalto 40 41 )
3494 ( "=>" calcFunc-evalto 40 -1 ))) 3499 ( "=>" calcFunc-evalto 40 -1 )))
3495(defvar math-expr-opers math-standard-opers) 3500
3501(defun math-standard-ops ()
3502 (if calc-multiplication-has-precedence
3503 (cons
3504 '( "*" * 196 195 )
3505 (cons
3506 '( "2x" * 196 195 )
3507 math-standard-opers))
3508 (cons
3509 '( "*" * 186 185 )
3510 (cons
3511 '( "2x" * 186 185 )
3512 math-standard-opers))))
3513
3514(defun math-standard-ops-p ()
3515 (let ((meo (caar math-expr-opers)))
3516 (and (stringp meo)
3517 (string= meo "*"))))
3518
3519(defvar math-expr-opers (math-standard-ops))
3520
3521(defun math-expr-ops ()
3522 (if (math-standard-ops-p)
3523 (math-standard-ops)
3524 math-expr-opers))
3496 3525
3497;;;###autoload 3526;;;###autoload
3498(defun calc-grab-region (top bot arg) 3527(defun calc-grab-region (top bot arg)