unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: How to test for native JSON support?
Date: Tue, 4 May 2021 16:32:52 +0200	[thread overview]
Message-ID: <CAArVCkSDOFU2oaGMOyHSV0B3Sx3CTnKEqgCa2HXTtPPewqMzJA@mail.gmail.com> (raw)
In-Reply-To: <2510de19-5b28-06d3-9a7b-631c9e506578@yandex.ru>

Am Di., 4. Mai 2021 um 16:31 Uhr schrieb Dmitry Gutov <dgutov@yandex.ru>:
>
> On 04.05.2021 17:01, Eli Zaretskii wrote:
>
> > Feel free to suggest a patch,
>
> Like this?
>
> diff --git a/src/json.c b/src/json.c
> index 3f1d27ad7f..ece057ae41 100644
> --- a/src/json.c
> +++ b/src/json.c
> @@ -596,8 +596,7 @@ DEFUN ("json-serialize", Fjson_serialize,
> Sjson_serialize, 1, MANY,
>       }
>     if (!json_initialized)
>       {
> -      message1 ("jansson library not found");
> -      return Qnil;
> +      Fsignal (Qerror, list1 (build_unibyte_string ("jansson library
> not found")));
>       }
>   #endif
>
> @@ -707,8 +706,7 @@ DEFUN ("json-insert", Fjson_insert, Sjson_insert, 1,
> MANY,
>       }
>     if (!json_initialized)
>       {
> -      message1 ("jansson library not found");
> -      return Qnil;
> +      Fsignal (Qerror, list1 (build_unibyte_string ("jansson library
> not found")));
>       }
>   #endif
>
> @@ -966,8 +964,7 @@ DEFUN ("json-parse-string", Fjson_parse_string,
> Sjson_parse_string, 1, MANY,
>       }
>     if (!json_initialized)
>       {
> -      message1 ("jansson library not found");
> -      return Qnil;
> +      Fsignal (Qerror, list1 (build_unibyte_string ("jansson library
> not found")));
>       }
>   #endif
>
> @@ -1065,8 +1062,7 @@ DEFUN ("json-parse-buffer", Fjson_parse_buffer,
> Sjson_parse_buffer,
>       }
>     if (!json_initialized)
>       {
> -      message1 ("jansson library not found");
> -      return Qnil;
> +      Fsignal (Qerror, list1 (build_unibyte_string ("jansson library
> not found")));
>       }
>   #endif
>

Can you make this signal a specific error symbol so that callers can
catch the error and react accordingly, e.g. by falling back to
json.el?



  reply	other threads:[~2021-05-04 14:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02 12:09 How to test for native JSON support? Joost Kremers
2021-05-03  0:20 ` Nikolay Kudryavtsev
2021-05-03  8:21   ` Joost Kremers
2021-05-03 14:38     ` Nikolay Kudryavtsev
2021-05-03 18:59       ` Joost Kremers
2021-05-03 19:42   ` Dmitry Gutov
2021-05-03 22:33     ` Nikolay Kudryavtsev
2021-05-03 22:39       ` Dmitry Gutov
2021-05-04 11:40       ` Tim Landscheidt
2021-05-04 12:16         ` Eli Zaretskii
2021-05-04 12:29           ` Joost Kremers
2021-05-04 12:50             ` Eli Zaretskii
2021-05-04 13:06               ` Joost Kremers
2021-05-04 13:17               ` Dmitry Gutov
2021-05-04 14:01                 ` Eli Zaretskii
2021-05-04 14:30                   ` Dmitry Gutov
2021-05-04 14:32                     ` Philipp Stephani [this message]
2021-05-04 14:41                       ` Dmitry Gutov
2021-05-04 15:16                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAArVCkSDOFU2oaGMOyHSV0B3Sx3CTnKEqgCa2HXTtPPewqMzJA@mail.gmail.com \
    --to=p.stephani2@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).