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

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

[elpa] externals/osm 1bd4751bcf 34/77: Better link names


From: ELPA Syncer
Subject: [elpa] externals/osm 1bd4751bcf 34/77: Better link names
Date: Mon, 7 Mar 2022 08:58:06 -0500 (EST)

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

    Better link names
---
 README.org |  4 ++--
 osm.el     | 23 +++++++++++++----------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/README.org b/README.org
index 0202dfa198..f98a194654 100644
--- a/README.org
+++ b/README.org
@@ -13,7 +13,7 @@
 
 * Features
 
-- Parallel fetching of tiles via curl
+- Parallel fetching of tiles with curl
 - Scrolling in large and small steps
 - Zooming with keys or with mouse click
 - Map scale indicator
@@ -31,7 +31,7 @@ Top-level commands:
 - =osm-goto=: Go to coordinates
 - =osm-server=: Select server
 
-Key bindings:
+Key bindings in =osm-mode= buffer:
 - ~+~ and ~-~: Zooming
 - ~<arrow>~: Small step scrolling
 - ~C-<arrow>~, ~M-<arrow>~: Large step scrolling
diff --git a/osm.el b/osm.el
index c3ebd2eef9..78447e6e88 100644
--- a/osm.el
+++ b/osm.el
@@ -553,13 +553,13 @@ We need two distinct images which are not `eq' for the 
display properties.")
 (defun osm--make-bookmark ()
   "Make OSM bookmark."
   (setq bookmark-current-bookmark nil) ;; Reset bookmark to use new name
-  `(,(osm--buffer-name-with-coordinates)
+  `(,(osm--bookmark-name)
     (coordinate ,(osm--lat) ,(osm--lon) ,osm--zoom)
     (server . ,osm-server)
     (handler . ,#'osm-bookmark-jump)))
 
-(defun osm--buffer-name-with-coordinates ()
-  "Return buffer description."
+(defun osm--bookmark-name ()
+  "Return default bookmark name."
   (if (osm--generated-name-p)
       (format "osm: %.2f° %.2f° %s"
               (osm--lat) (osm--lon)
@@ -568,6 +568,15 @@ We need two distinct images which are not `eq' for the 
display properties.")
      "\\`\\*\\|\\*\\(?:<[0-9]+>\\)?\\'"
      "" (buffer-name))))
 
+(defun osm--link-data ()
+  "Return link data."
+  (list (osm--lat) (osm--lon) osm--zoom
+        (and (not (eq osm-server (default-value 'osm-server))) osm-server)
+        (let ((name (string-remove-prefix "osm: " (osm--bookmark-name))))
+          (if (eq osm-server (default-value 'osm-server))
+              (string-remove-suffix (concat " " (osm--server-property :name)) 
name)
+            name))))
+
 (defun osm--default-buffer-name ()
   "Return default buffer name."
   (format "*osm: %s*" (osm--server-property :name)))
@@ -631,12 +640,6 @@ We need two distinct images which are not `eq' for the 
display properties.")
         (car bm)
       (format "*%s*" (car bm))))))
 
-(defun osm--link-data ()
-  "Return link data."
-  (list (osm--lat) (osm--lon) osm--zoom
-        (and (not (eq osm-server (default-value 'osm-server))) osm-server)
-        (osm--buffer-name-with-coordinates)))
-
 (defun osm--description ()
   "Return descriptive string for current map."
   (message "Fetching location name...")
@@ -658,7 +661,7 @@ We need two distinct images which are not `eq' for the 
display properties.")
   (interactive)
   (when-let (desc (osm--description))
     (rename-buffer
-     (format "*osm: %s %.2f° %.2f° %s*"
+     (format "*osm: %s, %.2f° %.2f° %s*"
              desc (osm--lat) (osm--lon)
              (osm--server-property :name))
      'unique)))



reply via email to

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