Mercurial > emacs
comparison lisp/calc/calc-units.el @ 98201:1d82f8f9b231
(calc-convert-temperature): Use default units when appropriate.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Wed, 17 Sep 2008 02:25:37 +0000 |
parents | 6c9af2bfcfee |
children | f9165517710c |
comparison
equal
deleted
inserted
replaced
98200:4f3b2bef6df0 | 98201:1d82f8f9b231 |
---|---|
471 (error "Bad format in units expression: %s" (nth 2 uold))) | 471 (error "Bad format in units expression: %s" (nth 2 uold))) |
472 (or (math-units-in-expr-p expr nil) | 472 (or (math-units-in-expr-p expr nil) |
473 (setq expr (math-mul expr uold))) | 473 (setq expr (math-mul expr uold))) |
474 (setq defunits (math-get-default-units expr)) | 474 (setq defunits (math-get-default-units expr)) |
475 (setq unew (or new-units | 475 (setq unew (or new-units |
476 (math-read-expr | 476 (read-string |
477 (read-string | 477 (concat |
478 (concat | 478 (if uoldname |
479 (if uoldname | 479 (concat "Old temperature units: " |
480 (concat "Old temperature units: " | 480 uoldname |
481 uoldname | 481 ", new units") |
482 ", new units") | 482 "New temperature units") |
483 "New temperature units") | 483 (if defunits |
484 (if defunits | 484 (concat " (default " |
485 (concat " (default " | 485 defunits |
486 defunits | 486 "): ") |
487 "): ") | 487 ": "))))) |
488 ": ")))))) | 488 (setq unew (math-read-expr (if (string= unew "") defunits unew))) |
489 (when (eq (car-safe unew) 'error) | 489 (when (eq (car-safe unew) 'error) |
490 (error "Bad format in units expression: %s" (nth 2 unew))) | 490 (error "Bad format in units expression: %s" (nth 2 unew))) |
491 (math-put-default-units unew) | 491 (math-put-default-units unew) |
492 (let ((ntemp (calc-normalize | 492 (let ((ntemp (calc-normalize |
493 (math-simplify-units | 493 (math-simplify-units |