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

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

[elpa] externals/osm 26f7074931 1/2: osm-search-server: New customizatio


From: ELPA Syncer
Subject: [elpa] externals/osm 26f7074931 1/2: osm-search-server: New customization option
Date: Sun, 19 Nov 2023 03:58:15 -0500 (EST)

branch: externals/osm
commit 26f7074931f7872a60612234138c4e12cab965d8
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    osm-search-server: New customization option
---
 CHANGELOG.org |  1 +
 osm.el        | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index a168da13a7..f553c9c503 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -4,6 +4,7 @@
 
 * Development
 
+- =osm-search-server=: New customization option.
 - Automatically register Org geo links.
 
 * Version 0.14 (2023-10-14)
diff --git a/osm.el b/osm.el
index 3db01486e0..a09991be6b 100644
--- a/osm.el
+++ b/osm.el
@@ -69,6 +69,12 @@ A comma-separated specifies descending order of preference.  
See also
 `url-mime-language-string'."
   :type 'string)
 
+(defcustom osm-search-server
+  "https://nominatim.openstreetmap.org";
+  "Server used to search for location names.
+The server must offer the nominatim.org API."
+  :type 'string)
+
 (defcustom osm-server-defaults
   '(:min-zoom 2
     :max-zoom 19
@@ -1430,8 +1436,9 @@ When called interactively, call the function `osm-home'."
             (alist-get
              'display_name
              (osm--fetch-json
-              (format 
"https://nominatim.openstreetmap.org/reverse?format=json&accept-language=%s&zoom=%s&lat=%s&lon=%s";
-                      osm-search-language (min 18 (max 3 osm--zoom)) lat 
lon)))))))
+              (format 
"%s/reverse?format=json&accept-language=%s&zoom=%s&lat=%s&lon=%s"
+                      osm-search-server osm-search-language
+                      (min 18 (max 3 osm--zoom)) lat lon)))))))
 
 (defun osm--fetch-json (url)
   "Get json from URL."
@@ -1458,13 +1465,15 @@ When called interactively, call the function 
`osm-home'."
          ,@(mapcar #'string-to-number (alist-get 'boundingbox x)))))
    (or
     (osm--fetch-json
-     (format 
"https://nominatim.openstreetmap.org/search?format=json&accept-language=%s&q=%s";
-             osm-search-language (url-encode-url needle))))))
+     (format "%s/search?format=json&accept-language=%s&q=%s"
+             osm-search-server osm-search-language
+             (url-encode-url needle))))))
 
 ;;;###autoload
 (defun osm-search (needle &optional lucky)
-  "Globally search for NEEDLE and display the map.
-If the prefix argument LUCKY is non-nil take the first result and jump there."
+  "Globally search for NEEDLE on `osm-search-server' and display the map.
+If the prefix argument LUCKY is non-nil take the first result and jump there.
+See `osm-search-server' and `osm-search-language' for customization."
   (interactive
    (list
     (minibuffer-with-setup-hook



reply via email to

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