diff options
| author | Jay Belanger | 2009-01-27 01:21:54 +0000 |
|---|---|---|
| committer | Jay Belanger | 2009-01-27 01:21:54 +0000 |
| commit | d22546d532f21703cce908a40c66929511ecde8a (patch) | |
| tree | 3b89a097b0c5716c6170da7be633c0eb5b736a1c | |
| parent | 1b2d606c19e7d11b7b67a1ad911d59c60c2a4ff0 (diff) | |
| download | emacs-d22546d532f21703cce908a40c66929511ecde8a.tar.gz emacs-d22546d532f21703cce908a40c66929511ecde8a.zip | |
(cal-sel-mult-both-sides): Add an option to expand the denominator.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calc/calc-sel.el | 16 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8dbaebaf440..46413a868be 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2009-01-27 Jay Belanger <jay.p.belanger@gmail.com> | ||
| 2 | |||
| 3 | * calc/calc-sel.el (cal-sel-mult-both-sides): Add an option to | ||
| 4 | expand the denominator. | ||
| 5 | |||
| 1 | 2009-01-26 Michael Albinus <michael.albinus@gmx.de> | 6 | 2009-01-26 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 7 | ||
| 3 | * net/dbus.el (dbus-event-error-hooks): New variable. | 8 | * net/dbus.el (dbus-event-error-hooks): New variable. |
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 @@ | |||
| 752 | (list (and calc-sel-reselect val)))))) | 752 | (list (and calc-sel-reselect val)))))) |
| 753 | (calc-handle-whys)))) | 753 | (calc-handle-whys)))) |
| 754 | 754 | ||
| 755 | (defun calc-sel-mult-both-sides (no-simp &optional divide) | 755 | (defun calc-sel-mult-both-sides (arg &optional divide) |
| 756 | (interactive "P") | 756 | (interactive "P") |
| 757 | (calc-wrapper | 757 | (calc-wrapper |
| 758 | (calc-preserve-point) | 758 | (calc-preserve-point) |
| 759 | (let* ((num (max 1 (calc-locate-cursor-element (point)))) | 759 | (let* ((no-simp (consp arg)) |
| 760 | (num (max 1 (calc-locate-cursor-element (point)))) | ||
| 760 | (calc-sel-reselect calc-keep-selection) | 761 | (calc-sel-reselect calc-keep-selection) |
| 761 | (entry (calc-top num 'entry)) | 762 | (entry (calc-top num 'entry)) |
| 762 | (expr (car entry)) | 763 | (expr (car entry)) |
| @@ -794,10 +795,13 @@ | |||
| 794 | rhs (math-simplify rhs)) | 795 | rhs (math-simplify rhs)) |
| 795 | (and (eq func '/) | 796 | (and (eq func '/) |
| 796 | (or (Math-equal (nth 1 sel) 1) | 797 | (or (Math-equal (nth 1 sel) 1) |
| 797 | (Math-equal (nth 1 sel) -1) | 798 | (Math-equal (nth 1 sel) -1)) |
| 798 | (and (memq (car-safe (nth 2 sel)) '(+ -)) | 799 | ; (and (memq (car-safe (nth 2 sel)) '(+ -)) |
| 799 | (memq (car-safe alg) '(+ -)))) | 800 | ; (memq (car-safe alg) '(+ -)))) |
| 800 | (setq rhs (math-expand-term rhs))))) | 801 | (unless arg |
| 802 | (setq rhs (math-expand-term rhs)))))) | ||
| 803 | (if (and arg (not no-simp)) | ||
| 804 | (setq rhs (calcFunc-expand rhs (unless (= arg 0) arg)))) | ||
| 801 | (setq alg (calc-encase-atoms | 805 | (setq alg (calc-encase-atoms |
| 802 | (calc-normalize (list func lhs rhs))))) | 806 | (calc-normalize (list func lhs rhs))))) |
| 803 | (setq rhs (list (if divide '* '/) sel alg)) | 807 | (setq rhs (list (if divide '* '/) sel alg)) |