From 10c3a26ace07f2e2d9a2c55839c0ccfa3a1fad32 Mon Sep 17 00:00:00 2001 From: Osmo Karppinen Date: Sun, 3 Dec 2023 16:23:36 +0200 Subject: [PATCH] Add function eww-copy-point-link-url to eww. Function will copy URL of link pointed by the pointer to the killring in eww. Also new key binding and menu item added for the function. I think that key "c" is good key for this. --- lisp/net/eww.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 77bb6be..80b56b1 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1102,6 +1102,7 @@ eww-mode-map "&" #'eww-browse-with-external-browser "d" #'eww-download "w" #'eww-copy-page-url + "c" #'eww-copy-point-link-url "A" #'eww-copy-alternate-url "C" #'url-cookie-list "v" #'eww-view-source @@ -1136,6 +1137,7 @@ eww-mode-map ["Download" eww-download t] ["View page source" eww-view-source] ["Copy page URL" eww-copy-page-url t] + ["Copy link URL pointed" eww-copy-point-link-url t] ["List histories" eww-list-histories t] ["Switch to buffer" eww-switch-to-buffer t] ["List buffers" eww-list-buffers t] @@ -1984,6 +1986,17 @@ eww-copy-page-url (message "%s" (plist-get eww-data :url)) (kill-new (plist-get eww-data :url))) +(defun eww-copy-point-link-url () + "Copy the URL of the link pointed by the pointer to the killring." + (interactive nil eww-mode) + (let ((url (get-text-property (point) 'shr-url))) + (if url + (progn + (kill-new url) + (message "%s" url)) + (progn (message "No url at the point.") + nil)))) + (defun eww-download () "Download URL to `eww-download-directory'. Use link at point if there is one, else the current page's URL." -- 2.42.0