branch: externals/compat commit 47aeeb110f3d4836bf808ba761bcf1a51918461f Author: Philip Kaludercic <phil...@posteo.net> Commit: Philip Kaludercic <phil...@posteo.net>
Refine conditions for functions from json.c Before 28.1, if Emacs is not compiled with JSON support, these functions will return nil and generate a message. --- compat-27.1.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/compat-27.1.el b/compat-27.1.el index 7afca8b3ab..2855fc6301 100644 --- a/compat-27.1.el +++ b/compat-27.1.el @@ -157,7 +157,8 @@ In you specify the same value for `:null-object' and `:false-object', a potentially ambiguous situation, the JSON output will not contain any JSON false values." :cond (condition-case nil - (json-parse-string "[]") + (let ((inhibit-message t)) + (equal (json-parse-string "[]") nil)) (json-unavailable t) (void-function t)) (require 'json) @@ -171,7 +172,8 @@ This is the same as (insert (json-serialize OBJECT)), but potentially faster. See the function `json-serialize' for allowed values of OBJECT." :cond (condition-case nil - (json-parse-string "[]") + (let ((inhibit-message t)) + (equal (json-parse-string "[]") nil)) (json-unavailable t) (void-function t)) (insert (apply #'compat--json-serialize object args))) @@ -201,7 +203,8 @@ to represent a JSON null value. It defaults to `:null'. The keyword argument `:false-object' specifies which object to use to represent a JSON false value. It defaults to `:false'." :cond (condition-case nil - (json-parse-string "[]") + (let ((inhibit-message t)) + (equal (json-parse-string "[]") nil)) (json-unavailable t) (void-function t)) (require 'json) @@ -244,7 +247,8 @@ to represent a JSON null value. It defaults to `:null'. The keyword argument `:false-object' specifies which object to use to represent a JSON false value. It defaults to `:false'." :cond (condition-case nil - (json-parse-string "[]") + (let ((inhibit-message t)) + (equal (json-parse-string "[]") nil)) (json-unavailable t) (void-function t)) (require 'json)