"Christopher M. Miles" <[email protected]> writes:

>> Will it provide completion UI?
>
> I write a little change on the function `org-attach-attach`, it basically 
> looks like this:
> ...

> (completing-read-multiple "Files to keep as attachment: "
>                               (directory-files
>                                (or (progn
>                                      (require 'dired-aux)
>                                      (dired-dwim-target-directory))
>                                    (read-directory-name
>                                     "Select source directory: "
>                                     default-directory))))

This will force multi-step UI, which is awkward.

> Ihor, hope you can give out thought, review `org-attach-attach' function
> code to see whether it's possible for multiple files.

FYI, I am personally using

(defvar yant/org-attach-default-source "~/Downloads/"
  "Default directory to attach the files from.")

(define-advice org-attach-attach (:around (oldfun files &rest args) 
start-from-default-directory)
  "Look for new attachments from `yant/org-attach-default-source' directory 
instead of `default-directory'."
  (interactive
   (list
    (mapcar #'directory-file-name
            (helm-read-file-name
             "File to keep as an attachment:"
             :initial-input
             (or (progn
                   (require 'dired-aux)
                   (dired-dwim-target-directory))
                 (and yant/org-attach-default-source
                      (file-name-as-directory yant/org-attach-default-source))
                 default-directory)
             :marked-candidates t))
    current-prefix-arg
    nil))
  (if (listp files)
      (mapc (lambda (file) (apply oldfun file args)) files)
    (apply oldfun files args)))

But that cannot be upstreamed.
Unfortunately, I do not know a built-in way to read multiple files.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to