org-setup-yank-dnd-handlers: Support MacOS dnd URIs

* lisp/org.el (org-setup-yank-dnd-handlers): MacOS uses
"file:/Users/juergenfenn/Desktop/test-file.jpeg" instead of file:///
stype URIs in DND data.  Handle this URI style.

We do not need to worry about converting the URI -
`org--dnd-local-file-handler' uses `dnd-get-local-file-name' that
takes care about URI-to-path conversion.

Reported-by: Juergen Fenn <jfenn@gmx.net>
Link: https://orgmode.org/list/875xur1aql.fsf@localhost
This commit is contained in:
Ihor Radchenko 2024-06-03 11:02:52 +02:00
parent 671ca44df0
commit 0477df8aab
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 9 additions and 6 deletions

View File

@ -20703,12 +20703,15 @@ it has a `diary' type."
;;; Yank media handler and DND ;;; Yank media handler and DND
(defun org-setup-yank-dnd-handlers () (defun org-setup-yank-dnd-handlers ()
"Setup the `yank-media' and DND handlers for buffer." "Setup the `yank-media' and DND handlers for buffer."
(setq-local dnd-protocol-alist (let ((handler (if (>= emacs-major-version 30)
(cons (cons "^file:///" #'org--dnd-multi-local-file-handler
(if (>= emacs-major-version 30) #'org--dnd-local-file-handler)))
#'org--dnd-multi-local-file-handler (setq-local dnd-protocol-alist
#'org--dnd-local-file-handler)) (append
dnd-protocol-alist)) (list (cons "^file:///" handler)
(cons "^file:/[^/]" handler)
(cons "^file:[^/]" handler))
dnd-protocol-alist)))
(when (fboundp 'yank-media-handler) (when (fboundp 'yank-media-handler)
(yank-media-handler "image/.*" #'org--image-yank-media-handler) (yank-media-handler "image/.*" #'org--image-yank-media-handler)
;; Looks like different DEs go for different handler names, ;; Looks like different DEs go for different handler names,