]> code.delx.au - gnu-emacs-elpa/commitdiff
Add a work-around for bug#19582, present before Emacs 24.5.
authorWolfgang Jenkner <wjenkner@inode.at>
Fri, 26 Feb 2016 14:22:40 +0000 (15:22 +0100)
committerWolfgang Jenkner <wjenkner@inode.at>
Fri, 26 Feb 2016 14:32:44 +0000 (15:32 +0100)
* packages/metar/metar.el (metar-convert-unit): Rewrite expr if it
starts with the `neg' operator.  Technically, this is wrong because
various functions in calc-units expect already simplified
expressions.  In practice, it should work around the above bug.

packages/metar/metar.el

index 9575313279cc3a478801e23ceacdce77ac6f8967..a05a353b9284f2100f8b3f7464437e4c38d384d6 100644 (file)
@@ -249,6 +249,9 @@ It must have the signature of `math-convert-units', which is the default."
   (unless (symbolp new-unit)
     (setq new-unit (intern new-unit)))
   (let ((expr (math-simplify (math-read-expr value))))
+    ;; Sneakily work around bug#19582.
+    (when (eq (car-safe expr) 'neg)
+      (setq expr `(* -1 ,(cadr expr))))
     (cl-assert (or (math-zerop expr)
                   (not (memq (math-single-units-in-expr-p expr) '(nil wrong))))
               nil