[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19401: 25.0.50; metar.el (metar-convert-temperature) wrong type argu
From: |
Wolfgang Jenkner |
Subject: |
bug#19401: 25.0.50; metar.el (metar-convert-temperature) wrong type argument stringp nil |
Date: |
Wed, 14 Jan 2015 02:47:28 +0100 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (berkeley-unix) |
On Tue, Jan 13 2015, Wolfgang Jenkner wrote:
> Please note that this patch assumes that the patch from (Bug#19582) has
> been applied.
Actually, the following patch (on top of the last one) might be enough
for metar to avoid the need for that fix from bug#19582, and so to
remain compatible with older (than the future trunk ;-) emacs versions.
>From ad084a9b35e79f3524e4ef01137cf256c0509266 Mon Sep 17 00:00:00 2001
From: Wolfgang Jenkner <wjenkner@inode.at>
Date: Wed, 14 Jan 2015 02:31:01 +0100
Subject: [PATCH] [metar] Add a work-around for bug#19582.
* 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 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/packages/metar/metar.el b/packages/metar/metar.el
index 9575313..a05a353 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
--
2.2.1