diff options
| author | Cecilio Pardo | 2024-09-21 15:30:27 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2024-09-22 12:45:42 +0300 |
| commit | e8f0baf354b117837fd686e2bf6ca8df15bd1cd4 (patch) | |
| tree | d510fd35ce2a56d890a25d06401b90e86210da1c | |
| parent | 0f4c09d26782835a7e31bf29c92d72a6a27a3ff1 (diff) | |
| download | emacs-e8f0baf354b117837fd686e2bf6ca8df15bd1cd4.tar.gz emacs-e8f0baf354b117837fd686e2bf6ca8df15bd1cd4.zip | |
Fix multi-file drag-and-drop on MS-Windows
Pass all dropped files to 'dnd-handle-multiple-urls' in
one call instead on doing multiple calls (Bug#73258).
* lisp/term/w32-win.el (w32-dropped-file-to-url): New function to
convert file name to a url for dnd.
(w32-handle-dropped-file): Changed to use 'w32-dropped-file-to-url'.
(w32-drag-n-drop): Changed to pass all files to
'dnd-handle-multiple-urls'/
| -rw-r--r-- | lisp/term/w32-win.el | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 3c0acf368f4..b57b3dd3bef 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el | |||
| @@ -101,6 +101,13 @@ | |||
| 101 | ;; (princ event)) | 101 | ;; (princ event)) |
| 102 | 102 | ||
| 103 | (defun w32-handle-dropped-file (window file-name) | 103 | (defun w32-handle-dropped-file (window file-name) |
| 104 | (dnd-handle-multiple-urls | ||
| 105 | window | ||
| 106 | (list | ||
| 107 | (w32-dropped-file-to-url file-name)) | ||
| 108 | 'private)) | ||
| 109 | |||
| 110 | (defun w32-dropped-file-to-url (file-name) | ||
| 104 | (let ((f (if (eq system-type 'cygwin) | 111 | (let ((f (if (eq system-type 'cygwin) |
| 105 | (cygwin-convert-file-name-from-windows file-name t) | 112 | (cygwin-convert-file-name-from-windows file-name t) |
| 106 | (subst-char-in-string ?\\ ?/ file-name))) | 113 | (subst-char-in-string ?\\ ?/ file-name))) |
| @@ -117,14 +124,11 @@ | |||
| 117 | (split-string (encode-coding-string f coding) | 124 | (split-string (encode-coding-string f coding) |
| 118 | "/") | 125 | "/") |
| 119 | "/"))) | 126 | "/"))) |
| 120 | ;; FIXME: is the W32 build capable only of receiving a single file | 127 | (concat |
| 121 | ;; from each drop? | 128 | (if (eq system-type 'cygwin) |
| 122 | (dnd-handle-multiple-urls window (list (concat | 129 | "file://" |
| 123 | (if (eq system-type 'cygwin) | 130 | "file:") |
| 124 | "file://" | 131 | file-name)) |
| 125 | "file:") | ||
| 126 | file-name)) | ||
| 127 | 'private)) | ||
| 128 | 132 | ||
| 129 | (defun w32-drag-n-drop (event &optional new-frame) | 133 | (defun w32-drag-n-drop (event &optional new-frame) |
| 130 | "Edit the files listed in the drag-n-drop EVENT. | 134 | "Edit the files listed in the drag-n-drop EVENT. |
| @@ -146,8 +150,11 @@ Switch to a buffer editing the last file dropped." | |||
| 146 | (raise-frame) | 150 | (raise-frame) |
| 147 | (setq window (selected-window)) | 151 | (setq window (selected-window)) |
| 148 | 152 | ||
| 149 | (mapc (apply-partially #'w32-handle-dropped-file window) | 153 | (dnd-handle-multiple-urls |
| 150 | (car (cdr (cdr event))))))) | 154 | window |
| 155 | (mapcar #'w32-dropped-file-to-url | ||
| 156 | (car (cdr (cdr event)))) | ||
| 157 | 'private)))) | ||
| 151 | 158 | ||
| 152 | (defun w32-drag-n-drop-other-frame (event) | 159 | (defun w32-drag-n-drop-other-frame (event) |
| 153 | "Edit the files listed in the drag-n-drop EVENT, in other frames. | 160 | "Edit the files listed in the drag-n-drop EVENT, in other frames. |