emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat ec82f43ef0 1/2: Use same test as json-available-


From: ELPA Syncer
Subject: [elpa] externals/compat ec82f43ef0 1/2: Use same test as json-available-p for json.c functions
Date: Sat, 28 May 2022 08:57:31 -0400 (EDT)

branch: externals/compat
commit ec82f43ef01a67c1875754efb9612e0c42099582
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Use same test as json-available-p for json.c functions
---
 compat-27.el | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/compat-27.el b/compat-27.el
index 56f69267a2..29af04036f 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -159,11 +159,10 @@ represent a JSON false value.  It defaults to `:false'.
 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
-            (let ((inhibit-message t))
-              (equal (json-parse-string "[]") nil))
-          (json-unavailable t)
-          (void-function t))
+  :cond (not (condition-case nil
+                 (json-serialize t)
+               (:success t)
+               (json-unavailable nil)))
   :realname compat--json-serialize
   (require 'json)
   (letrec ((fix (lambda (obj)
@@ -220,11 +219,10 @@ any JSON false values."
 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
-            (let ((inhibit-message t))
-              (equal (json-parse-string "[]") nil))
-          (json-unavailable t)
-          (void-function t))
+  :cond (not (condition-case nil
+                 (json-serialize t)
+               (:success t)
+               (json-unavailable nil)))
   (insert (apply #'compat--json-serialize object args)))
 
 (compat-defun json-parse-string (string &rest args)
@@ -251,11 +249,10 @@ 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
-            (let ((inhibit-message t))
-              (equal (json-parse-string "[]") nil))
-          (json-unavailable t)
-          (void-function t))
+  :cond (not (condition-case nil
+                 (json-serialize t)
+               (:success t)
+               (json-unavailable nil)))
   (require 'json)
   (condition-case err
       (let ((json-object-type (or (plist-get args :object-type) 'hash-table))
@@ -295,11 +292,10 @@ 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
-            (let ((inhibit-message t))
-              (equal (json-parse-string "[]") nil))
-          (json-unavailable t)
-          (void-function t))
+  :cond (not (condition-case nil
+                 (json-serialize t)
+               (:success t)
+               (json-unavailable nil)))
   (require 'json)
   (condition-case err
       (let ((json-object-type (or (plist-get args :object-type) 'hash-table))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]