]> code.delx.au - gnu-emacs/commitdiff
(cal-sel-mult-both-sides): Add an option to expand the denominator.
authorJay Belanger <jay.p.belanger@gmail.com>
Tue, 27 Jan 2009 01:21:54 +0000 (01:21 +0000)
committerJay Belanger <jay.p.belanger@gmail.com>
Tue, 27 Jan 2009 01:21:54 +0000 (01:21 +0000)
lisp/ChangeLog
lisp/calc/calc-sel.el

index 8dbaebaf44067cff022adaadd5703493fadf8b77..46413a868bed2d3a9e2bcb068398512b2a818374 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-27  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-sel.el (cal-sel-mult-both-sides): Add an option to
+       expand the denominator.
+
 2009-01-26  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/dbus.el (dbus-event-error-hooks): New variable.
index 179d1e1abfe4b20ff5b25f162a5b642521573954..62debf5d1e27e5ea3fc3343a4e535c47fe6c493b 100644 (file)
                                     (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))
                              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))