emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110596: calc/calc-units.el (math-ext


From: Jay Belanger
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110596: calc/calc-units.el (math-extract-units): Properly extract powers of units.
Date: Fri, 19 Oct 2012 23:14:32 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110596
committer: Jay Belanger <address@hidden>
branch nick: trunk
timestamp: Fri 2012-10-19 23:14:32 -0500
message:
  calc/calc-units.el (math-extract-units): Properly extract powers of units.
modified:
  lisp/ChangeLog
  lisp/calc/calc-units.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-10-20 03:42:02 +0000
+++ b/lisp/ChangeLog    2012-10-20 04:14:32 +0000
@@ -1,3 +1,8 @@
+2012-10-20  Jay Belanger  <address@hidden>
+
+       * calc/calc-units.el (math-extract-units): Properly extract powers
+       of units.
+
 2012-10-20  Daniel Colascione  <address@hidden>
 
        * frame.el (make-frame): Set x-display-name as we used to in order

=== modified file 'lisp/calc/calc-units.el'
--- a/lisp/calc/calc-units.el   2012-08-12 04:32:28 +0000
+++ b/lisp/calc/calc-units.el   2012-10-20 04:14:32 +0000
@@ -1481,10 +1481,16 @@
            (mapcar 'math-remove-units (cdr expr))))))
 
 (defun math-extract-units (expr)
-  (if (memq (car-safe expr) '(* /))
-      (cons (car expr)
-           (mapcar 'math-extract-units (cdr expr)))
-    (if (math-check-unit-name expr) expr 1)))
+  (cond
+   ((memq (car-safe expr) '(* /))
+    (cons (car expr)
+          (mapcar 'math-extract-units (cdr expr))))
+   ((and
+     (eq (car-safe expr) '^)
+     (math-check-unit-name (nth 1 expr)))
+    expr)
+   ((math-check-unit-name expr) expr)
+   (t 1)))
 
 (defun math-build-units-table-buffer (enter-buffer)
   (if (not (and math-units-table math-units-table-buffer-valid


reply via email to

[Prev in Thread] Current Thread [Next in Thread]