On Fri, 20 Jan 2012 07:55:03 -0400, David Bremner <david@tethera.net> wrote: > On Fri, 20 Jan 2012 10:39:23 +0100, Thomas Jost <schnouki@schnouki.net> wrote: > > JSON does not support hex literals (0x..) so numbers must be formatted as %d > > instead of %x. > > --- > > notmuch-show.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > Probably I'm just being lazy here, but can you explain why this change > does not require a corresponding change on the emacs side? Because Emacs already does the right thing. JSON numbers are supposed to be decimal only (see http://json.org/: digits are 0-9 only), but the current code could result in displaying a hexadecimal number instead ("c" instead of "12"). This would then trigger an error in Emacs, or in any other correct JSON parser. However we are quite lucky: because of the possible values of the gmime error codes, such an error cannot happen. The most common gmime error codes are 1 (expired signature), 2 (no public key), 4 (expired key) and 8 (revoked key). The other possible value is 16 (unsupported algorithm) but obviously it is much more rare. If this happens, the current code will add '"errors": 10' (hex for 16...). This is valid JSON (it looks like a decimal number) but it is incorrect (should be 16, not 10). With this patch, notmuch will correctly display '"errors": 16' if such a case happens. (By the way, this issue was spotted by Austin Clements in id:"20120117034714.GG16740@mit.edu", so he deserves the credits :)) Regards, -- Thomas/Schnouki