Mercurial > emacs
changeset 101528:b07dab1a7538
(cal-sel-mult-both-sides): Add an option to expand the denominator.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Tue, 27 Jan 2009 01:20:42 +0000 |
parents | 8e4b80af88d5 |
children | bd0e69d589f1 |
files | lisp/calc/calc-sel.el |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/calc/calc-sel.el Tue Jan 27 01:20:27 2009 +0000 +++ b/lisp/calc/calc-sel.el Tue Jan 27 01:20:42 2009 +0000 @@ -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))