* lisp/json.el (json-alist-p): Only return non-nil if the alist has
authorSimon Schubert <2@0x2c.org>
Sun, 24 Nov 2013 22:49:37 +0000 (00:49 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 24 Nov 2013 22:49:37 +0000 (00:49 +0200)
simple keys.

Fixes: debbugs:13518

lisp/ChangeLog
lisp/json.el

index 7365e8c..acc3435 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-24  Simon Schubert  <2@0x2c.org>
+
+       * json.el (json-alist-p): Only return non-nil if the alist has
+       simple keys (Bug#13518).
+
 2013-11-22  Mihir Rege  <mihirrege@gmail.com>  (tiny change)
 
        * progmodes/js.el (js--ctrl-statement-indentation): Fix indent
index aaa7bb0..21523c1 100644 (file)
@@ -126,9 +126,10 @@ without indentation.")
   (mapconcat 'identity strings separator))
 
 (defun json-alist-p (list)
-  "Non-null if and only if LIST is an alist."
+  "Non-null if and only if LIST is an alist with simple keys."
   (while (consp list)
-    (setq list (if (consp (car list))
+    (setq list (if (and (consp (car list))
+                        (atom (caar list)))
                    (cdr list)
                  'not-alist)))
   (null list))