emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/calc calc-sel.el


From: Jay Belanger
Subject: [Emacs-diffs] emacs/lisp/calc calc-sel.el
Date: Tue, 27 Jan 2009 01:20:42 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Jay Belanger <jpb>      09/01/27 01:20:42

Modified files:
        lisp/calc      : calc-sel.el 

Log message:
        (cal-sel-mult-both-sides): Add an option to expand the denominator.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/calc/calc-sel.el?cvsroot=emacs&r1=1.24&r2=1.25

Patches:
Index: calc-sel.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calc/calc-sel.el,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- calc-sel.el 9 Jan 2009 03:57:15 -0000       1.24
+++ calc-sel.el 27 Jan 2009 01:20:42 -0000      1.25
@@ -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))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]