Function: org--dnd-local-file-handler

org--dnd-local-file-handler is a byte-compiled function defined in org.el.gz.

Signature

(org--dnd-local-file-handler URL ACTION &optional SEPARATOR)

Documentation

Handle file URL as per ACTION.

SEPARATOR is the string to insert after each link. It may be nil in which case, space is inserted.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org--dnd-local-file-handler (url action &optional separator)
  "Handle file URL as per ACTION.
SEPARATOR is the string to insert after each link.  It may be nil
in which case, space is inserted."
  (unless separator
    (setq separator " "))
  (let ((method (if (eq org-yank-dnd-method 'ask)
                    (org--dnd-rmc
                     "What to do with file?"
                     '((?a "attach" attach)
                       (?o "open" open)
                       (?f "insert file: link" file-link)))
                  org-yank-dnd-method)))
    (pcase method
      (`attach (org--dnd-attach-file url action separator))
      (`open (dnd-open-local-file url action))
      (`file-link
       (let ((filename (dnd-get-local-file-name url)))
         (insert (org-link-make-string (concat "file:" filename)) separator))))))