summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-sel.el
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2009-01-27 01:21:54 +0000
committerJay Belanger <jay.p.belanger@gmail.com>2009-01-27 01:21:54 +0000
commitd22546d532f21703cce908a40c66929511ecde8a (patch)
tree3b89a097b0c5716c6170da7be633c0eb5b736a1c /lisp/calc/calc-sel.el
parent1b2d606c19e7d11b7b67a1ad911d59c60c2a4ff0 (diff)
downloademacs-d22546d532f21703cce908a40c66929511ecde8a.tar.gz
(cal-sel-mult-both-sides): Add an option to expand the denominator.
Diffstat (limited to 'lisp/calc/calc-sel.el')
-rw-r--r--lisp/calc/calc-sel.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/calc/calc-sel.el b/lisp/calc/calc-sel.el
index 179d1e1abfe..62debf5d1e2 100644
--- a/lisp/calc/calc-sel.el
+++ b/lisp/calc/calc-sel.el
@@ -752,11 +752,12 @@
(list (and calc-sel-reselect val))))))
(calc-handle-whys))))
-(defun calc-sel-mult-both-sides (no-simp &optional divide)
+(defun calc-sel-mult-both-sides (arg &optional divide)
(interactive "P")
(calc-wrapper
(calc-preserve-point)
- (let* ((num (max 1 (calc-locate-cursor-element (point))))
+ (let* ((no-simp (consp arg))
+ (num (max 1 (calc-locate-cursor-element (point))))
(calc-sel-reselect calc-keep-selection)
(entry (calc-top num 'entry))
(expr (car entry))
@@ -794,10 +795,13 @@
rhs (math-simplify rhs))
(and (eq func '/)
(or (Math-equal (nth 1 sel) 1)
- (Math-equal (nth 1 sel) -1)
- (and (memq (car-safe (nth 2 sel)) '(+ -))
- (memq (car-safe alg) '(+ -))))
- (setq rhs (math-expand-term rhs)))))
+ (Math-equal (nth 1 sel) -1))
+; (and (memq (car-safe (nth 2 sel)) '(+ -))
+; (memq (car-safe alg) '(+ -))))
+ (unless arg
+ (setq rhs (math-expand-term rhs))))))
+ (if (and arg (not no-simp))
+ (setq rhs (calcFunc-expand rhs (unless (= arg 0) arg))))
(setq alg (calc-encase-atoms
(calc-normalize (list func lhs rhs)))))
(setq rhs (list (if divide '* '/) sel alg))