(Emacs/elisp/org-bookmark)+org-bookmark/copy-bookmark-url

Just a nice helper function.
This commit is contained in:
2024-08-21 16:43:39 +01:00
parent 3bbfab5e4f
commit f9d2fdb928

View File

@@ -110,6 +110,17 @@ the URL.
FUNC is a callable or function which takes one parameter (the URL
as a string) and produces some action of opening it.")
(defun org-bookmark/copy-bookmark-url ()
"Copy a bookmark's URL."
(interactive)
(let* ((bookmarks (org-bookmark/bookmarks))
(choice (completing-read "Choose bookmark: " (mapcar #'car bookmarks) nil t))
(pair (assoc choice bookmarks #'string=)))
(if (null pair)
(error (format "`%s' is not a valid bookmark" choice))
(message "[bookmark]: Copying bookmark `%s` (`%s`)" (car pair) (cdr pair))
(kill-new (cdr pair)))))
(defun org-bookmark/open-bookmark ()
"Open a bookmark. Uses ORG-BOOKMARK/DISPATCH-LIST to dispatch
opening the url to some handler function."