Subject: bug#77857: [PATCH] Let eww-copy-page-url append to existing kill

From: James Thomas <[email-masked]>
Date: Thu, 17 Apr 2025 10:07:52 +0530

Tags: patch
Severity: wishlist

From c1f63607d0107c1ec39489bdcfdeb2c086112fbf Mon Sep 17 00:00:00 2001
From: James Thomas <[email-masked]>
Date: Thu, 17 Apr 2025 09:56:27 +0530
Subject: [PATCH] Let eww-copy-page-url append to existing kill

* lisp/net/eww.el (eww-copy-page-url): Make the change.
---
 lisp/net/eww.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index c3e927b74a6..df16f12875a 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -2159,7 +2159,10 @@ eww-copy-page-url
   "Copy the URL of the current page into the kill ring."
   (interactive nil eww-mode)
   (message "%s" (plist-get eww-data :url))
-  (kill-new (plist-get eww-data :url)))
+  (let ((str (plist-get eww-data :url)))
+    (if (eq last-command 'kill-region)
+        (kill-append str nil)
+      (kill-new str))))
 
 (defun eww-download ()
   "Download a Web page to `eww-download-directory'.
-- 
2.46.0

The way I use this, it lets me add the link to a description of the page
(usually text copied from itself) which is now fit for sharing with C-y.

Thoughts?

--