org-download

a fork of abo-abo's org-download
git clone https://git.trogloxene.org/org-download.git
Log | Files | Refs | README

commit 97bec7412e1a4d6e9031c7a0568d0f065cd9fd00
parent 42ac361ef5502017e6fc1bceb00333eba90402f4
Author: stardiviner <numbchild@gmail.com>
Date:   Sun,  3 Jan 2021 22:48:07 +0800

org-download.el (org-download-yank): Detect whether current kill-ring yank is URL

Fixes #150

Diffstat:
Morg-download.el | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/org-download.el b/org-download.el @@ -367,8 +367,12 @@ COMMAND is a format-style string with two slots for LINK and FILENAME." (defun org-download-yank () "Call `org-download-image' with current kill." (interactive) - (org-download-image - (replace-regexp-in-string "\n+$" "" (current-kill 0)))) + (let ((k (current-kill 0))) + (unless (url-type (url-generic-parse-url k)) + (user-error "Not a URL: %s" k)) + (org-download-image + (replace-regexp-in-string + "\n+$" "" k)))) (defun org-download-screenshot (&optional basename) "Capture screenshot and insert the resulting file.