emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/metar e0b58d1 12/16: Add a work-around for bug#19582, p


From: Stefan Monnier
Subject: [elpa] externals/metar e0b58d1 12/16: Add a work-around for bug#19582, present before Emacs 24.5.
Date: Sat, 28 Nov 2020 23:16:37 -0500 (EST)

branch: externals/metar
commit e0b58d169e5d0885221caa6784539480bf4145c6
Author: Wolfgang Jenkner <wjenkner@inode.at>
Commit: Wolfgang Jenkner <wjenkner@inode.at>

    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.
---
 metar.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/metar.el b/metar.el
index 9575313..a05a353 100644
--- a/metar.el
+++ b/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



reply via email to

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