org-download

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

commit ae3cb8e149c9089a8a92213d80859b8fffdb384e
parent d04adffe21f2c54a55c875d34afbddc568e35f28
Author: Feng Shu <tumashu@163.com>
Date:   Sun, 26 May 2019 08:06:39 +0800

Allow org-download-screenshot-method is a function

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

diff --git a/org-download.el b/org-download.el @@ -140,9 +140,10 @@ will be used." (const :tag "screencapture" "screencapture -i %s") ;; take an image that is already on the clipboard, for Linux (const :tag "xclip" - "xclip -selection clipboard -t image/png -o > %s") + "xclip -selection clipboard -t image/png -o > %s") ;; take an image that is already on the clipboard, for Windows - (const :tag "imagemagick/convert" "convert clipboard: %s"))) + (const :tag "imagemagick/convert" "convert clipboard: %s") + (function :tag "Custom function"))) (defcustom org-download-screenshot-file (expand-file-name "screenshot.png" temporary-file-directory) "The file to capture screenshots." @@ -301,8 +302,11 @@ The screenshot tool is determined by `org-download-screenshot-method'." (interactive) (let ((default-directory "~")) (make-directory (file-name-directory org-download-screenshot-file) t) - (shell-command (format org-download-screenshot-method - org-download-screenshot-file))) + (if (functionp org-download-screenshot-method) + (funcall org-download-screenshot-method + org-download-screenshot-file) + (shell-command (format org-download-screenshot-method + org-download-screenshot-file)))) (org-download-image org-download-screenshot-file)) (declare-function org-attach-dir "org-attach")