Function: math-put-default-units

math-put-default-units is a byte-compiled function defined in calc-units.el.gz.

Signature

(math-put-default-units EXPR &optional COMP STD)

Documentation

Put the units in EXPR in the default units table.

If COMP or STD is non-nil, put that in the units table instead.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-units.el.gz
(defun math-put-default-units (expr &optional comp std)
  "Put the units in EXPR in the default units table.
If COMP or STD is non-nil, put that in the units table instead."
  (let* ((new-units (or comp std (math-get-units expr)))
         (standard-units (math-get-standard-units
                          (cond
                           (comp (math-simplify-units expr))
                           (std expr)
                           (t new-units))))
         (default-units (gethash standard-units math-default-units-table)))
    (unless (eq standard-units 1)
      (cond
       ((not default-units)
        (puthash standard-units (list new-units) math-default-units-table))
       ((not (equal new-units (car default-units)))
        (puthash standard-units
                 (list new-units (car default-units))
                 math-default-units-table))))))