unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Richard Stallman <rms@gnu.org>
Cc: Eli Zaretskii <eliz@gnu.org>, 55278@debbugs.gnu.org
Subject: bug#55278: 29.0.50; OSM package
Date: Sat, 07 May 2022 11:32:56 +0800	[thread overview]
Message-ID: <87y1ze6mqf.fsf@yahoo.com> (raw)
In-Reply-To: <E1nn7ES-0001jX-D1@fencepost.gnu.org> (Richard Stallman's message of "Fri, 06 May 2022 19:19:32 -0400")

Richard Stallman <rms@gnu.org> writes:

> That is strange.  If the function json-parse-string is defined in the
> Emacs sources, why compile it only if something else is enabled?

Jansson is a library for parsing JSON.  Emacs provides two mechanisms
for parsing JSON into Lisp data, one of which is based on the Jansson
library, and the other is implemented in Lisp inside json.el.

OSM uses the former, but it can trivially be made to use the latter:

--- a/osm.el
+++ b/osm.el
@@ -39,6 +39,7 @@
 
 (require 'bookmark)
 (require 'dom)
+(require 'json)
 (eval-when-compile
   (require 'cl-lib)
   (require 'subr-x))
@@ -1376,14 +1377,12 @@
 
 (defun osm--fetch-json (url)
   "Get json from URL."
-  (json-parse-string
+  (json-read-from-string
    (let ((default-process-coding-system '(utf-8-unix . utf-8-unix)))
      (shell-command-to-string
       (concat
        "curl " osm-curl-options " "
-       (shell-quote-argument url))))
-   :array-type 'list
-   :object-type 'alist))
+       (shell-quote-argument url))))))
 
 ;;;###autoload
 (defun osm-search (search &optional lucky)





  reply	other threads:[~2022-05-07  3:32 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 [this message]
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
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=87y1ze6mqf.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=55278@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    --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).