aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/json.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/json.el')
-rw-r--r--lisp/json.el11
1 files changed, 5 insertions, 6 deletions
diff --git a/lisp/json.el b/lisp/json.el
index f2086474a8b..82cc9c71bf5 100644
--- a/lisp/json.el
+++ b/lisp/json.el
@@ -609,12 +609,11 @@ transforms an unsortable MAP into a sortable alist."
609 "Insert a JSON representation of ALIST at point. 609 "Insert a JSON representation of ALIST at point.
610Sort ALIST first if `json-encoding-object-sort-predicate' is 610Sort ALIST first if `json-encoding-object-sort-predicate' is
611non-nil. Sorting can optionally be DESTRUCTIVE for speed." 611non-nil. Sorting can optionally be DESTRUCTIVE for speed."
612 (json--print-map (if (and json-encoding-object-sort-predicate alist) 612 (json--print-map (let ((pred json-encoding-object-sort-predicate))
613 (sort (if destructive alist (copy-sequence alist)) 613 (if (and pred alist)
614 (lambda (a b) 614 (sort alist :key #'car :lessp pred
615 (funcall json-encoding-object-sort-predicate 615 :in-place destructive)
616 (car a) (car b)))) 616 alist))))
617 alist)))
618 617
619;; The following two are unused but useful to keep around due to the 618;; The following two are unused but useful to keep around due to the
620;; inherent ambiguity of lists. 619;; inherent ambiguity of lists.