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.
This commit is contained in:
Po Lu 2022-05-31 13:31:18 +00:00
parent 0a7bd8c07c
commit 41a2def162

View file

@ -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))))