From: Wolfgang Jenkner Date: Fri, 26 Feb 2016 14:22:40 +0000 (+0100) Subject: Add a work-around for bug#19582, present before Emacs 24.5. X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/4a0b5fb85ecd689346719881e149d1f4341b5da4 Add a work-around for bug#19582, present before Emacs 24.5. * 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. --- diff --git a/packages/metar/metar.el b/packages/metar/metar.el index 957531327..a05a353b9 100644 --- a/packages/metar/metar.el +++ b/packages/metar/metar.el @@ -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