From 0477df8aabe780f2542bc491935f1bf088802417 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Mon, 3 Jun 2024 11:02:52 +0200 Subject: [PATCH] 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 Link: https://orgmode.org/list/875xur1aql.fsf@localhost --- lisp/org.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 386ad70b4..d941bae41 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20703,12 +20703,15 @@ it has a `diary' type." ;;; Yank media handler and DND (defun org-setup-yank-dnd-handlers () "Setup the `yank-media' and DND handlers for buffer." - (setq-local dnd-protocol-alist - (cons (cons "^file:///" - (if (>= emacs-major-version 30) - #'org--dnd-multi-local-file-handler - #'org--dnd-local-file-handler)) - dnd-protocol-alist)) + (let ((handler (if (>= emacs-major-version 30) + #'org--dnd-multi-local-file-handler + #'org--dnd-local-file-handler))) + (setq-local dnd-protocol-alist + (append + (list (cons "^file:///" handler) + (cons "^file:/[^/]" handler) + (cons "^file:[^/]" handler)) + dnd-protocol-alist))) (when (fboundp 'yank-media-handler) (yank-media-handler "image/.*" #'org--image-yank-media-handler) ;; Looks like different DEs go for different handler names,