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

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

[elpa] externals/osm 22dd76e095: Automatically register Org links


From: ELPA Syncer
Subject: [elpa] externals/osm 22dd76e095: Automatically register Org links
Date: Fri, 17 Nov 2023 09:58:33 -0500 (EST)

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

    Automatically register Org links
---
 CHANGELOG.org |  4 ++++
 README.org    |  5 -----
 osm-ol.el     | 38 --------------------------------------
 osm.el        | 32 ++++++++++++++++++++++----------
 4 files changed, 26 insertions(+), 53 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index 2ac64722d3..a168da13a7 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -2,6 +2,10 @@
 #+author: Daniel Mendler
 #+language: en
 
+* Development
+
+- Automatically register Org geo links.
+
 * Version 0.14 (2023-10-14)
 
 - Compatibility with =pixel-scroll-precision-mode=.
diff --git a/README.org b/README.org
index a5b05bf538..9c4d6b7633 100644
--- a/README.org
+++ b/README.org
@@ -54,11 +54,6 @@ Please take a look at the 
[[https://github.com/minad/osm/wiki][wiki]] for additi
   (osm-server 'default) ;; Configure the tile server
   (osm-copyright t)     ;; Display the copyright information
 
-  :init
-  ;; Make sure that Org geo: link support is loaded
-  (with-eval-after-load 'org
-    (require 'osm-ol))
-
   :config
 
   ;; Add custom servers, see also https://github.com/minad/osm/wiki
diff --git a/osm-ol.el b/osm-ol.el
deleted file mode 100644
index 14dc3d0023..0000000000
--- a/osm-ol.el
+++ /dev/null
@@ -1,38 +0,0 @@
-;;; osm-ol.el --- Org links for `osm-mode' -*- lexical-binding: t -*-
-
-;; Copyright (C) 2022-2023 Free Software Foundation, Inc.
-
-;; This file is part of GNU Emacs.
-
-;; This program is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; Org links for `osm-mode'.
-
-;;; Code:
-
-(require 'ol)
-
-(declare-function osm "ext:osm")
-(declare-function osm--org-link-props "ext:osm")
-(org-link-set-parameters
- "geo"
- :follow (lambda (link _) (osm (concat "geo:" link)))
- :store (lambda ()
-          (when (derived-mode-p 'osm-mode)
-            (apply #'org-link-store-props (osm--org-link-props)))))
-
-(provide 'osm-ol)
-;;; osm-ol.el ends here
diff --git a/osm.el b/osm.el
index b486e11107..3db01486e0 100644
--- a/osm.el
+++ b/osm.el
@@ -872,7 +872,7 @@ Should be at least 7 days according to the server usage 
policies."
         (osm--put-pin pins 'osm-poi (cadr pt) (cddr pt) (car pt))))
     pins))
 
-;; TODO The Bresenham algorithm used here to add the line segments to the tiles
+;; TODO: The Bresenham algorithm used here to add the line segments to the 
tiles
 ;; has the issue that lines which go along a tile border may be drawn only
 ;; partially. We can fix this by starting Bresenham at (x0±line width, y0±line
 ;; width).
@@ -966,9 +966,9 @@ xmlns='http://www.w3.org/2000/svg' 
xmlns:xlink='http://www.w3.org/1999/xlink'>
 <image xlink:href='"
                           (if (eval-when-compile (> emacs-major-version 27))
                               (file-name-nondirectory file)
-                            ;; NOTE: On Emacs 27, :base-uri and embedding by
-                            ;; file path is not supported. Use the less
-                            ;; efficient base64 encoding.
+                            ;; On Emacs 27, :base-uri and embedding by file 
path
+                            ;; is not supported. Use the less efficient base64
+                            ;; encoding.
                             (svg--image-data
                              file
                              (if (member (file-name-extension file) '("jpg" 
"jpeg"))
@@ -1481,7 +1481,7 @@ If the prefix argument LUCKY is non-nil take the first 
result and jump there."
                        (osm--sorted-table osm--search-history)
                        nil nil nil 'osm--search-history))
       current-prefix-arg))
-  ;; TODO add search bounded to current viewbox, bounded=1, viewbox=x1,y1,x2,y2
+  ;; TODO: Add search bounded to current viewbox, bounded=1, 
viewbox=x1,y1,x2,y2
   (let* ((results (or (osm--search needle) (error "No results for `%s'" 
needle)))
          (selected
           (or
@@ -1642,27 +1642,39 @@ If prefix ARG is given, store url as Elisp expression."
     (message "Saved in the kill ring: %s" url)))
 
 (cl-defun osm-add-server (server
-                          &rest props
+                          &rest properties
                           &key name description group url max-connections
                           max-zoom min-zoom download-batch subdomains 
copyright)
-  "Add SERVER with properties to `osm-server-list'.
+  "Add SERVER with PROPERTIES to `osm-server-list'.
 The properties are checked as keyword arguments.  See
 `osm-server-list' for documentation of the keywords."
   (declare (indent 1))
   (ignore name description group url max-connections max-zoom
           min-zoom download-batch subdomains copyright)
   (dolist (sym '(:name :description :group :url))
-    (unless (stringp (plist-get props sym))
+    (unless (stringp (plist-get properties sym))
       (error "Server property %s is required" sym)))
   (unless (and server (symbolp server))
-    (error "Server id must be a symbol."))
-  (setf (alist-get server osm-server-list) props)
+    (error "Server id must be a symbol"))
+  (setf (alist-get server osm-server-list) properties)
   nil)
 
 ;;;###autoload
 (when (>= emacs-major-version 28)
   (add-to-list 'browse-url-default-handlers '("\\`geo:" . osm)))
 
+;;;###autoload
+(eval-after-load 'ol
+  (lambda ()
+    (declare-function org-link-set-parameters "ol")
+    (declare-function osm--org-link-props "ext:osm")
+    (org-link-set-parameters
+     "geo"
+     :follow (lambda (link _) (osm (concat "geo:" link)))
+     :store (lambda ()
+              (when (derived-mode-p 'osm-mode)
+                (apply 'org-link-store-props (osm--org-link-props)))))))
+
 (dolist (sym (list #'osm-center #'osm-up #'osm-down #'osm-left #'osm-right
                    #'osm-up-up #'osm-down-down #'osm-left-left 
#'osm-right-right
                    #'osm-zoom-out #'osm-zoom-in #'osm-bookmark-set 
#'osm-gpx-hide



reply via email to

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