From 0d16b6b8100421011123313ecb11142b87a750eb Mon Sep 17 00:00:00 2001 From: Dov Grobgeld Date: Sat, 12 Jan 2019 19:47:59 +0200 Subject: Added function for copying the url under the cursor into the kill-ring. --- nov.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nov.el') diff --git a/nov.el b/nov.el index 432acda..e8452b1 100644 --- a/nov.el +++ b/nov.el @@ -378,6 +378,7 @@ Each alist item consists of the identifier and full path." (define-key map (kbd "[") 'nov-previous-document) (define-key map (kbd "t") 'nov-goto-toc) (define-key map (kbd "RET") 'nov-browse-url) + (define-key map (kbd "c") 'nov-copy-url) (define-key map (kbd "") 'mouse-face) (define-key map (kbd "") 'nov-browse-url) (define-key map (kbd "TAB") 'shr-next-link) @@ -634,6 +635,15 @@ Internal URLs are visited with `nov-visit-relative-file'." (browse-url url) (apply 'nov-visit-relative-file (nov-url-filename-and-target url))))) +(defun nov-copy-url (&optional mouse-event) + (interactive (list last-nonmenu-event)) + (mouse-set-point mouse-event) + (let ((url (get-text-property (point) 'shr-url))) + (when (not url) + (user-error "No link under point")) + (kill-new url) + (message url))) + (defun nov-saved-places () "Retrieve saved places in `nov-save-place-file'." (when (and nov-save-place-file (file-exists-p nov-save-place-file)) -- cgit v1.2.3