branch: elpa/jabber
commit 3ab3a35dcb400c85797cd501e5c198cc80ff8c1d
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>

    image: Add jabber-chat-copy-url command bound to w
---
 lisp/jabber-chat.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/jabber-chat.el b/lisp/jabber-chat.el
index 8f57a4da30..9bf161fdbc 100644
--- a/lisp/jabber-chat.el
+++ b/lisp/jabber-chat.el
@@ -1339,9 +1339,17 @@ with the created image (or nil) followed by CBARGS."
 (defvar jabber-chat-url-keymap
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "RET") #'jabber-chat-url-action-at-point)
+    (define-key map "w" #'jabber-chat-copy-url)
     map)
   "Keymap active on inline images and downloadable URLs in chat buffers.")
 
+(defun jabber-chat-copy-url ()
+  "Copy the URL at point to the kill ring and display it."
+  (interactive)
+  (if-let* ((url (get-text-property (point) 'jabber-chat-image-url)))
+      (progn (kill-new url) (message "%s" url))
+    (user-error "No URL at point")))
+
 (defcustom jabber-chat-download-directory nil
   "Default directory for file downloads.
 When nil, use the last download directory from this session or

Reply via email to