[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/osm c648edc1b2 1/6: Add osm-bookmark-rename
From: |
ELPA Syncer |
Subject: |
[elpa] externals/osm c648edc1b2 1/6: Add osm-bookmark-rename |
Date: |
Tue, 8 Mar 2022 10:57:44 -0500 (EST) |
branch: externals/osm
commit c648edc1b2621f3b5effd0c86849a75a801c01d8
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add osm-bookmark-rename
---
README.org | 1 +
osm.el | 35 +++++++++++++++++++++++++++--------
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/README.org b/README.org
index f655bd2093..d57feaee86 100644
--- a/README.org
+++ b/README.org
@@ -82,6 +82,7 @@ Key bindings in =osm-mode= buffer:
- ~<osm-bookmark mouse-*>~: =osm-bookmark-delete-click= - Click on bookmark at
point to delete
- ~<down-mouse-*>~: =osm-drag= - Drag the map with the mouse
- ~d~, ~DEL~: =osm-bookmark-delete= - Delete selected bookmark
+- ~n~: =osm-bookmark-rename= - Rename selected bookmark
- ~g~: =osm-goto= - Go to location
- ~h~: =osm-home= - Go to home location
- ~s~: =osm-search= - Search for location
diff --git a/osm.el b/osm.el
index 9b92b1a20f..229d3611b1 100644
--- a/osm.el
+++ b/osm.el
@@ -167,6 +167,7 @@ Should be at least 7 days according to the server usage
policies."
(define-key map [M-down] #'osm-down-down)
(define-key map [M-left] #'osm-left-left)
(define-key map [M-right] #'osm-right-right)
+ (define-key map "n" #'osm-bookmark-rename)
(define-key map "d" #'osm-bookmark-delete)
(define-key map "\d" #'osm-bookmark-delete)
(define-key map "c" #'clone-buffer)
@@ -444,7 +445,7 @@ Should be at least 7 days according to the server usage
policies."
(when (and (>= q y) (< q (+ y 50)) (>= p (- x 20)) (< p (+ x 20)) (<
d min))
(setq min d found (list p q (car bm)))))))
(when found
- (message "Selected '%s'" (cddr found))
+ (message "%s" (caddr found))
(apply #'osm--put-transient-pin 'selected-bookmark found)
(osm--update))))
@@ -875,12 +876,18 @@ xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'>
(fset sym (lambda ()
(with-current-buffer buffer
(remove-hook 'pre-command-hook sym)
- (setq osm--transient-pin nil)
- ;; HACK: handle bookmark deletion
- (when (and (eq this-command #'osm-bookmark-delete)
- (eq id 'selected-bookmark))
- (osm-bookmark-delete help)
- (setq this-command #'ignore)))))
+ ;; HACK: handle bookmark deletion and renaming
+ (pcase this-command
+ ((and (guard (eq id 'selected-bookmark))
+ cmd (or 'osm-bookmark-delete 'osm-bookmark-rename))
+ (setq osm--transient-pin nil
+ this-command
+ (lambda ()
+ (interactive)
+ (funcall cmd help))))
+ ((guard osm--transient-pin)
+ (setq osm--transient-pin nil)
+ (osm--update))))))
(add-hook 'pre-command-hook sym)
(setq osm--transient-pin (list id x y help))))
@@ -911,6 +918,18 @@ xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'>
(bookmark-delete bm)
(osm--revert))
+;;;###autoload
+(defun osm-bookmark-rename (old-name)
+ "Rename osm bookmark OLD-NAME."
+ (interactive (list (car (osm--bookmark-read))))
+ (unwind-protect
+ (bookmark-rename
+ old-name
+ (read-from-minibuffer
+ "New name: " old-name nil nil
+ 'bookmark-history old-name))
+ (osm--revert)))
+
(defun osm--bookmark-read ()
"Read bookmark name."
(bookmark-maybe-load-default-file)
@@ -933,7 +952,7 @@ xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'>
(unwind-protect
(pcase-let* ((`(,lat ,lon ,desc) (osm--location-data 'selected-bookmark
"Bookmark"))
(def (osm--bookmark-name desc))
- (name (read-from-minibuffer "Bookmark name: " def nil nil
nil def))
+ (name (read-from-minibuffer "Bookmark name: " def nil nil
'bookmark-history def))
(bookmark-make-record-function
(lambda () (osm--make-bookmark name lat lon))))
(bookmark-set name)
- [elpa] externals/osm updated (87b4616642 -> b05a2514d2), ELPA Syncer, 2022/03/08
- [elpa] externals/osm c648edc1b2 1/6: Add osm-bookmark-rename,
ELPA Syncer <=
- [elpa] externals/osm 13db645b7c 4/6: Ignore click, ELPA Syncer, 2022/03/08
- [elpa] externals/osm fcd5d289d0 3/6: Always display home pin, ELPA Syncer, 2022/03/08
- [elpa] externals/osm b05a2514d2 6/6: Generated osm-prefixed key events, ELPA Syncer, 2022/03/08
- [elpa] externals/osm 2a3edeb745 5/6: Do not delete transient pin on ignored commands, ELPA Syncer, 2022/03/08
- [elpa] externals/osm 037d0213ac 2/6: Improve transient pin handling, ELPA Syncer, 2022/03/08