bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#55278: 29.0.50; OSM package


From: Po Lu
Subject: bug#55278: 29.0.50; OSM package
Date: Sat, 07 May 2022 11:32:56 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

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 via email to

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