unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Mendler <mail@daniel-mendler.de>
To: Lars Ingebrigtsen <larsi@gnus.org>, Richard Stallman <rms@gnu.org>
Cc: Philip Kaludercic <philipk@posteo.net>, 55278@debbugs.gnu.org
Subject: bug#55278: json-parse-string
Date: Mon, 9 May 2022 12:39:54 +0200	[thread overview]
Message-ID: <4534cafd-6e16-1ec6-1986-3ef441a5d5e8@daniel-mendler.de> (raw)
In-Reply-To: <87o8079f1s.fsf@gnus.org>



On 5/9/22 12:27, Lars Ingebrigtsen wrote:
> Richard Stallman <rms@gnu.org> writes:
> 
>> I agree that we should implement some built-in fallback mechanism
>> so that it works for all packages that use json parsing.
> 
> The two libraries aren't really compatible without reparsing the entire
> parse tree returned by them.  For instance, the C library returns:

The json-parse-string implementation in compat.el should be compatible
as far as I understood Philip and it relies on json.el.

> Libraries like osm.el depend on the former type, and it parses a lot of
> data, making compat transformations prohibitively slow.  We'd be doing
> our users a disservice if we were to just be slow here instead of
> telling them the real story: Build your Emacs with jansson support,
> already.  (This happens by default if you have the library installed.)

Yes, that's a good point. Should we rather bail out or try to do our
best by falling back to a slower implementation? For example eww bails
out if libxml is missing, probably rightly so.

In osm-mode I have a list of requirements which must be satisfied before
it can be used reasonably. These requirements are also listed in the
README and in the Commentary of the package.

  (unless (display-graphic-p)
    (warn "osm: Graphical display is required"))
  (dolist (type '(svg jpeg png))
    (unless (image-type-available-p type)
      (warn "osm: Support for %s images is missing" type)))
  (unless (libxml-available-p)
    (warn "osm: libxml is not available"))
  (unless (ignore-errors (equal [] (json-parse-string "[]")))
    (warn "osm: libjansson is not available"))

Daniel





  reply	other threads:[~2022-05-09 10:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 18:38 bug#55278: 29.0.50; OSM package Richard Stallman
2022-05-05 19:15 ` Eli Zaretskii
2022-05-06 12:15   ` Lars Ingebrigtsen
2022-05-06 23:19   ` Richard Stallman
2022-05-07  3:32     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-07  6:08     ` Eli Zaretskii
2022-05-07 23:08       ` Richard Stallman
2022-05-08  8:42 ` bug#55278: json-parse-string Daniel Mendler
2022-05-08 23:39   ` Richard Stallman
2022-05-09 10:27     ` Lars Ingebrigtsen
2022-05-09 10:39       ` Daniel Mendler [this message]
2022-05-09 10:45         ` Lars Ingebrigtsen
2022-05-09 10:57           ` Daniel Mendler
2022-05-09 23:20         ` Richard Stallman
2022-05-16 23:25         ` Richard Stallman
2022-05-17 19:12           ` Philip Kaludercic
2022-05-18 22:20             ` Richard Stallman
2022-05-09 23:20       ` Richard Stallman
2022-05-09 23:20       ` Richard Stallman

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=4534cafd-6e16-1ec6-1986-3ef441a5d5e8@daniel-mendler.de \
    --to=mail@daniel-mendler.de \
    --cc=55278@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=philipk@posteo.net \
    --cc=rms@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).