org-download

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

commit ed0932331ec2636be86a4baf4104717d38863822
parent d0e6793497d57a90543d711310ad26fae7c9bcba
Author: Oleh Krehel <ohwoeowho@gmail.com>
Date:   Mon,  5 Mar 2018 22:38:22 +0100

org-download.el (org-download-delete): Also works for any link to a file

When point is before "[[" and the link points to an existing file,
delete it and the link.

Diffstat:
Morg-download.el | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/org-download.el b/org-download.el @@ -415,6 +415,16 @@ It's inserted before the image link and is used to annotate it.") (delete-region (region-beginning) (region-end))) + ((looking-at org-any-link-re) + (let ((fname (org-link-unescape + (match-string-no-properties 2)))) + (when (file-exists-p fname) + (delete-file fname) + (delete-region (match-beginning 0) + (match-end 0)) + (when (eolp) + (delete-char 1))))) + (t (org-download--delete (line-beginning-position) (line-end-position)))) (when (eq org-download-method 'attach)