[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/osm 8f8328bd62: Add arguments to osm-search (Fix #14)
From: |
ELPA Syncer |
Subject: |
[elpa] externals/osm 8f8328bd62: Add arguments to osm-search (Fix #14) |
Date: |
Sat, 19 Mar 2022 13:57:37 -0400 (EDT) |
branch: externals/osm
commit 8f8328bd62ff166f25a45aea1ae77ce44f7c44e8
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add arguments to osm-search (Fix #14)
---
osm.el | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/osm.el b/osm.el
index 9168152fcb..8731fbd8eb 100644
--- a/osm.el
+++ b/osm.el
@@ -1315,15 +1315,16 @@ Optionally specify a SERVER and a COMMENT."
:object-type 'alist))))))
;;;###autoload
-(defun osm-search ()
- "Search for location and display the map."
- (interactive)
+(defun osm-search (search &optional lucky)
+ "Search for SEARCH and display the map.
+If the prefix argument LUCKY is non-nil take the first result and jump there."
+ (interactive
+ (list (completing-read "Location: "
+ (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
- (let* ((search (completing-read
- "Location: "
- (osm--sorted-table osm--search-history)
- nil nil nil 'osm--search-history))
- (json (json-parse-string
+ (let* ((json (json-parse-string
(shell-command-to-string
(concat
"curl " osm-curl-options " "
@@ -1342,7 +1343,9 @@ Optionally specify a SERVER and a COMMENT."
,lat ,lon
,@(mapcar #'string-to-number (alist-get 'boundingbox
x)))))
(or json (error "No results"))))
- (selected (or (cdr (assoc
+ (selected (or
+ (and (or lucky (not (cdr results))) (cdar results))
+ (cdr (assoc
(completing-read
(format "Matches for '%s': " search)
(osm--sorted-table results)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/osm 8f8328bd62: Add arguments to osm-search (Fix #14),
ELPA Syncer <=