summaryrefslogtreecommitdiff
path: root/lisp/calc
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2012-10-19 23:14:32 -0500
committerJay Belanger <jay.p.belanger@gmail.com>2012-10-19 23:14:32 -0500
commit4c9e95500fc913ad934e65c6625114e3f5532078 (patch)
tree9ea8b10a7e54f811e4f7aa179941e3e0e757b478 /lisp/calc
parent1a6e7e3807367b94c144d06fc2bdd1eb195731f7 (diff)
downloademacs-4c9e95500fc913ad934e65c6625114e3f5532078.tar.gz
calc/calc-units.el (math-extract-units): Properly extract powers of units.
Diffstat (limited to 'lisp/calc')
-rw-r--r--lisp/calc/calc-units.el14
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index 39f710f8322..58646ea114c 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -1481,10 +1481,16 @@ If COMP or STD is non-nil, put that in the units table instead."
(mapcar 'math-remove-units (cdr expr))))))
(defun math-extract-units (expr)
- (if (memq (car-safe expr) '(* /))
- (cons (car expr)
- (mapcar 'math-extract-units (cdr expr)))
- (if (math-check-unit-name expr) expr 1)))
+ (cond
+ ((memq (car-safe expr) '(* /))
+ (cons (car expr)
+ (mapcar 'math-extract-units (cdr expr))))
+ ((and
+ (eq (car-safe expr) '^)
+ (math-check-unit-name (nth 1 expr)))
+ expr)
+ ((math-check-unit-name expr) expr)
+ (t 1)))
(defun math-build-units-table-buffer (enter-buffer)
(if (not (and math-units-table math-units-table-buffer-valid