From: Lars Ingebrigtsen Date: Wed, 10 Jul 2019 11:23:43 +0000 (+0200) Subject: Fix pretty-printing of {} X-Git-Tag: emacs-27.0.90~2020 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b93bde184e1e0d21bde34a7fd660888bd04893d7;p=emacs.git Fix pretty-printing of {} * lisp/json.el (json-pretty-print): Fix reading {}, which returns nil. --- diff --git a/lisp/json.el b/lisp/json.el index eae5eda783d..d664dae05e4 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -764,13 +764,15 @@ With prefix argument MINIMIZE, minimize it instead." (json-null :json-null) ;; Ensure that ordering is maintained (json-object-type 'alist) + (err (gensym)) json) (save-restriction (narrow-to-region begin end) (goto-char begin) - (while (setq json (condition-case _ - (json-read) - (json-error nil))) + (while (not (eq (setq json (condition-case _ + (json-read) + (json-error err))) + err)) (delete-region begin (point)) (insert (json-encode json)) (setq begin (point))))))