Function: org--dnd-xds-function
org--dnd-xds-function is a byte-compiled function defined in
org.el.gz.
Signature
(org--dnd-xds-function NEED-NAME FILENAME)
Documentation
Handle file with FILENAME dropped via XDS protocol.
When NEED-NAME is t, FILENAME is the base name of the file to be saved. When NEED-NAME is nil, the drop is complete.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org--dnd-xds-function (need-name filename)
"Handle file with FILENAME dropped via XDS protocol.
When NEED-NAME is t, FILENAME is the base name of the file to be
saved.
When NEED-NAME is nil, the drop is complete."
(if need-name
(let ((method (if (eq org-yank-dnd-method 'ask)
(org--dnd-rmc
"What to do with dropped file?"
'((?a "attach" attach)
(?o "open" open)
(?f "insert file: link" file-link)))
org-yank-dnd-method)))
(setq-local org--dnd-xds-method method)
(pcase method
(`attach (expand-file-name filename (org-attach-dir 'create)))
(`open (expand-file-name (make-temp-name "emacs.") temporary-file-directory))
(`file-link (read-file-name "Write file to: " nil nil nil filename))))
(pcase org--dnd-xds-method
(`attach (insert (org-link-make-string
(concat "attachment:" (file-name-nondirectory filename)))))
(`file-link (insert (org-link-make-string (concat "file:" filename))))
(`open (find-file filename)))
(setq-local org--dnd-xds-method nil)))