From 41a2def162ee95db6a9ca7e904bbd7feee5e3ccf Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 31 May 2022 13:31:18 +0000 Subject: [PATCH] Convert FILE_NAME to refs on Haiku instead of text/uri-list * lisp/term/haiku-win.el (haiku-dnd-selection-converters): Use more appropriate target for file names. (haiku-dnd-convert-uri-list): Delete function. (haiku-dnd-convert-file-name): New function. Also handle remote file names. --- lisp/term/haiku-win.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el index 7f3bba52e59..a8cc1da731a 100644 --- a/lisp/term/haiku-win.el +++ b/lisp/term/haiku-win.el @@ -52,7 +52,7 @@ "The local value of the special `XdndSelection' selection.") (defvar haiku-dnd-selection-converters '((STRING . haiku-dnd-convert-string) - (text/uri-list . haiku-dnd-convert-uri-list)) + (FILE_NAME . haiku-dnd-convert-file-name)) "Alist of X selection types to functions that act as selection converters. The functions should accept a single argument VALUE, describing the value of the drag-and-drop selection, and return a list of @@ -141,9 +141,10 @@ VALUE as a unibyte string, or nil if VALUE was not a string." (list "text/plain" (string-to-unibyte (encode-coding-string value 'utf-8))))) -(defun haiku-dnd-convert-uri-list (value) +(defun haiku-dnd-convert-file-name (value) "Convert VALUE to a file system reference if it is a file name." (when (and (stringp value) + (not (file-remote-p value)) (file-exists-p value)) (list "refs" (propertize (expand-file-name value) 'type 'ref)))) -- 2.39.2