org-download icon indicating copy to clipboard operation
org-download copied to clipboard

setting download-dir in a setup file?

Open titaniumbones opened this issue 5 years ago • 1 comments

Is there any chance of adding an org-style setting for org-download-image-dir so that I can specify a path in a setup file? This would be helpful in projects that use a common setup for a bunch of different files.

Thanks for the cool tool, which I am finally using!

titaniumbones avatar Nov 16 '20 17:11 titaniumbones

@titaniumbones
you can redefine org-download-image-dir where org-download function call :

for example: I map C-M-y for org-download-paste-clipboard in doom :

(defun zz/org-download-paste-clipboard (&optional use-default-filename)
  (interactive "P")
  (require 'org-download)
   (setq org-download-image-dir (concat "images/" (file-name-sans-extension (buffer-name))))
  (let ((file
         (if (not use-default-filename)
             (read-string (format "Filename [%s]: " org-download-screenshot-basename)
                          nil nil org-download-screenshot-basename)
           nil)))
(org-download-clipboard file)))

 (map! :map org-mode-map
        "C-M-y" #'zz/org-download-paste-clipboard )

every time , call zz/org-download-paste-clipboard , at the same time org-download-image-dir change : (setq org-download-image-dir (concat "images/" (file-name-sans-extension (buffer-name))))

Imymirror avatar Dec 09 '20 17:12 Imymirror