diff options
author | Dov Grobgeld <dov.grobgeld@gmail.com> | 2019-01-12 19:47:59 +0200 |
---|---|---|
committer | Dov Grobgeld <dov.grobgeld@gmail.com> | 2019-01-12 19:47:59 +0200 |
commit | 0d16b6b8100421011123313ecb11142b87a750eb (patch) | |
tree | 70d20a449fb063ff138e73bebea91d4ca20d4f00 /nov.el | |
parent | 3bb7a4038f0c2100df671c9f1f33b785ed4ae296 (diff) |
Added function for copying the url under the cursor into the kill-ring.
Diffstat (limited to 'nov.el')
-rw-r--r-- | nov.el | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 "<follow-link>") 'mouse-face) (define-key map (kbd "<mouse-2>") '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)) |