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

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

[elpa] externals/osm 660793b39a 4/5: Add osm-home customizable variable


From: ELPA Syncer
Subject: [elpa] externals/osm 660793b39a 4/5: Add osm-home customizable variable
Date: Mon, 7 Mar 2022 12:57:57 -0500 (EST)

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

    Add osm-home customizable variable
---
 osm.el | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/osm.el b/osm.el
index b9397848c2..48176b22ac 100644
--- a/osm.el
+++ b/osm.el
@@ -102,6 +102,15 @@
   "List of tile servers."
   :type '(alist :key-type symbol :value-type plist))
 
+(defcustom osm-home
+  (let ((lat (bound-and-true-p calendar-latitude))
+        (lon (bound-and-true-p calendar-longitude)))
+    (if (and lat lon)
+        (list lat lon 12)
+      (list 0 0 3)))
+  "Home coordinates, latitude, longitude and zoom level."
+  :type '(list number number number))
+
 (defcustom osm-large-step 256
   "Scroll step in pixel."
   :type 'integer)
@@ -273,15 +282,6 @@ Should be at least 7 days according to the server usage 
policies."
   "Convert LAT/ZOOM to y coordinate in pixel."
   (floor (* 256 (expt 2.0 zoom) (osm--lat-to-normalized-y lat))))
 
-(defun osm--home-coordinates ()
-  "Return home coordinate triple."
-  (let ((lat (bound-and-true-p calendar-latitude))
-        (lon (bound-and-true-p calendar-longitude))
-        (zoom 11))
-    (unless (and lat lon)
-      (setq lat 0 lon 0 zoom 2))
-    (list lat lon zoom)))
-
 (defun osm--server-property (prop)
   "Return server property PROP."
   (plist-get (alist-get osm-server osm-server-list) prop))
@@ -655,7 +655,7 @@ c53 0 96 43 96 96S309 256 256 256z'/>
 (defun osm-home ()
   "Go to home coordinates."
   (interactive)
-  (osm--goto (osm--home-coordinates) nil))
+  (osm--goto osm-home nil))
 
 (defun osm--queue-info ()
   "Return queue info string."
@@ -785,7 +785,7 @@ c53 0 96 43 96 96S309 256 256 256z'/>
   (with-current-buffer
       (or
        (and (eq major-mode #'osm-mode) (current-buffer))
-       (pcase-let* ((`(,def-lat ,def-lon ,def-zoom) (or at 
(osm--home-coordinates)))
+       (pcase-let* ((`(,def-lat ,def-lon ,def-zoom) (or at osm-home))
                     (def-x (osm--lon-to-x def-lon def-zoom))
                     (def-y (osm--lat-to-y def-lat def-zoom))
                     (def-server (or server osm-server)))
@@ -813,7 +813,7 @@ c53 0 96 43 96 96S309 256 256 256z'/>
                       (setq osm--transient-pin nil)
                       (remove-hook 'pre-command-hook sym))))
         (add-hook 'pre-command-hook sym))
-      (setq at (or at (osm--home-coordinates))
+      (setq at (or at osm-home)
             osm--zoom (nth 2 at)
             osm--x (osm--lon-to-x (nth 1 at) osm--zoom)
             osm--y (osm--lat-to-y (nth 0 at) osm--zoom)



reply via email to

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