From 6d7ebb726dd39b5e5e9f12e0341a4bb350caf637 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Thu, 7 Mar 2013 20:11:25 -0600 Subject: [PATCH] * doc/misc/calc.texi (Basic Operations on Units): Fix cross-reference. * calc/calc-units.el (calc-convert-units): Fix the way that default new units are stored. --- doc/misc/ChangeLog | 5 +++++ doc/misc/calc.texi | 4 ++-- lisp/ChangeLog | 5 +++++ lisp/calc/calc-units.el | 12 +++++++----- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 12230bfb374..b634cf7433a 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2013-03-08 Jay Belanger + + * calc.texi (Basic Operations on Units): Fix + cross-reference. + 2013-03-07 Katsumi Yamaoka * gnus-faq.texi (FAQ 3-11): Now Gnus supports POP3 UIDL. diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 2d1f59cfa68..0bf7833ec34 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -27918,8 +27918,8 @@ simplified so that it doesn't contain any units, like @samp{ft/in} can be simplified to 12, then @kbd{u c} will still prompt for both old units and new units. You can ignore the prompt for old units with @key{RET}, or turn off the prompt by setting the customizable variable -@code{calc-allow-units-as-numbers} to @code{nil}. -@pxref{Customizing Calc}) Assuming the old and new units you give are +@code{calc-allow-units-as-numbers} to @code{nil}; +@pxref{Customizing Calc}.) Assuming the old and new units you give are consistent with each other, the result also will not contain any units. For example, @kbd{@w{u c} cm @key{RET} in @key{RET}} converts the number 2 on the stack to 5.08. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4f24f5b2c8c..c8a4a06f28d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-03-08 Jay Belanger + + * calc/calc-units.el (calc-convert-units): Fix the way that default + new units are stored. + 2013-03-07 Karl Fogel * bookmark.el: Define a face to highlight bookmark names in diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index b334d7b3b45..335980af4dd 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -503,11 +503,13 @@ If COMP or STD is non-nil, put that in the units table instead." (comp (eq (car-safe units) '+))) (unless (or unew std) (error "No units specified")) - (let ((res - (if std - (math-simplify-units (math-to-standard-units expr (nth 1 std))) - (math-convert-units expr units (and uoldname (not (equal uoldname "1"))))))) - (math-put-default-units res (if comp units)) + (let* ((noold (and uoldname (not (equal uoldname "1")))) + (res + (if std + (math-simplify-units (math-to-standard-units expr (nth 1 std))) + (math-convert-units expr units noold)))) + (unless std + (math-put-default-units (if noold units res) (if comp units))) (calc-enter-result 1 "cvun" res)))))) (defun calc-autorange-units (arg) -- 2.39.2