On Thu, Dec 18 2014, Ulf Jasper wrote: > It appears that the temperature value -1 °C ("M01") is causing the error > > (metar-convert-temperature "M07") => (-7 . degC) > (metar-convert-temperature "M01") => error (wrong-type-argument stringp nil) > > I suspect that this is the result of `math-mul-symb-fancy' (which > metar.el calls via calc-units) treating "-1" in a special way > > (math-mul-symb-fancy -7 '(var degC var-degC)) => (* -7 (var degC var-degC)) > (math-mul-symb-fancy -1 '(var degC var-degC)) => (neg (var degC var-degC)) There are problems in calc (Bug#19582) here. There's also a small problem in metar, viz., the string "-degC" is not parsed in the same way as "-1 degC". Since `metar-convert-unit' has (at least potentially) the same problem, the attached patch does a little refactoring of those two functions, where the actual conversion function from the calc library is passed as an additional optional argument to `metar-convert-unit', so that `metar-convert-temperature' reduces to just a call to the latter. The actual bug is simply resolved by passing t as the last argument to `math-convert-units' resp. `math-convert-temperature', so that these functions return the number without a unit. After all, we already know which unit we get... Please note that this patch assumes that the patch from (Bug#19582) has been applied.