From 488df60acc38854e089a0f115feba5787be14ae8 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Tue, 5 Aug 2014 20:15:03 +0200 Subject: [PATCH] * lisp/net/shr.el (shr-copy-url): Also copy the image URL. * lisp/net/shr.el (shr-copy-url): Also copy the image URL. --- lisp/ChangeLog | 4 ++++ lisp/net/shr.el | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aec717a159a..5ec506b63b0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-08-05 Lars Magne Ingebrigtsen + + * net/shr.el (shr-copy-url): Also copy the image URL. + 2014-08-05 Michael Albinus * net/tramp-cache.el (tramp-flush-file-function): Suppress function diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 58442575ad2..5e2e1eadf86 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -214,12 +214,16 @@ DOM should be a parse tree as generated by (overlay-put overlay 'before-string nil)))) (forward-line 1))))) -(defun shr-copy-url () +(defun shr-copy-url (&optional image-url) "Copy the URL under point to the kill ring. +If IMAGE-URL (the prefix) is non-nil, or there is no link under +point, but there is an image under point then copy the URL of the +image under point instead. If called twice, then try to fetch the URL and see whether it redirects somewhere else." - (interactive) - (let ((url (get-text-property (point) 'shr-url))) + (interactive "P") + (let ((url (or (get-text-property (point) 'shr-url) + (get-text-property (point) 'image-url)))) (cond ((not url) (message "No URL under point")) -- 2.11.4.GIT