From f9d2fdb92805d36bfbf7e59616eca22263677894 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 21 Aug 2024 16:43:39 +0100 Subject: (Emacs/elisp/org-bookmark)+org-bookmark/copy-bookmark-url Just a nice helper function. --- Emacs/.config/emacs/elisp/org-bookmark.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Emacs/.config/emacs/elisp/org-bookmark.el b/Emacs/.config/emacs/elisp/org-bookmark.el index 795e969..aa2a377 100644 --- a/Emacs/.config/emacs/elisp/org-bookmark.el +++ b/Emacs/.config/emacs/elisp/org-bookmark.el @@ -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." -- cgit v1.2.3-13-gbd6f