org-download

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

commit aad18aecef0c31081d5fe7b14cc135ab8904883f
parent a367669384859261bcb11bac4b782f231f972353
Author: Jethro Kuan <jethrokuan95@gmail.com>
Date:   Sat, 28 Dec 2019 14:49:01 +0800

org-download.el (org-download-screenshot) : don't insert screenshot on cancel

Screenshot tools return the same 0 exit-code when an attempt is
cancelled. Here I use the existence of the temporary file as an
indication of user intent. This means we need to clean up the temp
file after use.

Diffstat:
Morg-download.el | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/org-download.el b/org-download.el @@ -356,7 +356,9 @@ The screenshot tool is determined by `org-download-screenshot-method'." (shell-command-to-string (format org-download-screenshot-method org-download-screenshot-file)))) - (org-download-image org-download-screenshot-file)) + (when (file-exists-p org-download-screenshot-file) + (org-download-image org-download-screenshot-file) + (delete-file org-download-screenshot-file))) (declare-function org-attach-dir "org-attach") (declare-function org-attach-attach "org-attach")