]> git.eshelyaron.com Git - emacs.git/commitdiff
* calc/calc-units.el (math-consistent-units-p): Accept unit systems
authorJay Belanger <jay.p.belanger@gmail.com>
Sat, 19 May 2012 14:59:47 +0000 (09:59 -0500)
committerJay Belanger <jay.p.belanger@gmail.com>
Sat, 19 May 2012 14:59:47 +0000 (09:59 -0500)
as consistent units.

lisp/calc/calc-units.el

index 6d876cf79ba0a1d47c4aa29da06cb2d5dae7c0ff..e5c7b6737fb3d1bbcc73c691a4700fa0d999de48 100644 (file)
@@ -921,9 +921,12 @@ If EXPR is nil, return nil."
           (math-single-units-in-expr-p (nth 1 expr))))
        (t 'wrong)))
 
-(defun math-consistent-units-p (expr1 expr2)
-  "Non-nil if EXPR1 and EXPR2 have consistent units."
-  (math-numberp (math-get-units (list '/ expr1 expr2))))
+(defun math-consistent-units-p (expr newunits)
+  "Non-nil if EXPR and NEWUNITS have consistent units."
+  (or
+   (and (eq (car-safe newunits) 'var)
+        (assq (nth 1 newunits) math-standard-units-systems))
+   (math-numberp (math-get-units (list '/ expr newunits)))))
 
 (defun math-check-unit-consistency (expr units)
   "Give an error if EXPR and UNITS do not have consistent units."