(math-convert-units): Replace any composite unit by its definition.

This commit is contained in:
Jay Belanger 2005-11-09 06:02:54 +00:00
parent 675984ede6
commit 65b62d0acb
2 changed files with 10 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2005-11-08 Jay Belanger <belanger@truman.edu>
* calc/calc-units.el (math-convert-units): Replace any composite
unit by its definition.
2005-11-08 Lars Hansen <larsh@soem.dk>
* emacs-lisp/autoload.el (update-directory-autoloads): Add
obsolete function alias.

View file

@ -911,6 +911,11 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).")
(defvar math-cu-pure)
(defun math-convert-units (expr math-cu-new-units &optional math-cu-pure)
(if (eq (car-safe math-cu-new-units) 'var)
(let ((unew (assq (nth 1 math-cu-new-units)
(math-build-units-table))))
(if (eq (car-safe (nth 1 unew)) '+)
(setq math-cu-new-units (nth 1 unew)))))
(math-with-extra-prec 2
(let ((compat (and (not math-cu-pure)
(math-find-compatible-unit expr math-cu-new-units)))