summaryrefslogtreecommitdiff
path: root/lisp/select.el
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-06-03 19:43:06 +0800
committerPo Lu <luangruo@yahoo.com>2022-06-03 19:46:25 +0800
commitca2e7409dcd694742704e424c3f6f5bc5f230f25 (patch)
treec966c37aacd1071d72faeea5256f04999b6e57f2 /lisp/select.el
parent977f3f27c549db27a2d6fb33e0112b03f9b57371 (diff)
downloademacs-ca2e7409dcd694742704e424c3f6f5bc5f230f25.tar.gz
emacs-ca2e7409dcd694742704e424c3f6f5bc5f230f25.tar.bz2
emacs-ca2e7409dcd694742704e424c3f6f5bc5f230f25.zip
Allow dragging multiple files from a Dired buffer
* doc/lispref/frames.texi (Drag and Drop): Document new function `dnd-begin-drag-files'. * lisp/dired.el (dired-mouse-drag-files): Update doc string. (dired-map-over-marks): Accept a new value of ARG `marked', meaning to not fall back to the current file if no marks were found. (dired-mouse-drag): Handle marked files in an intuitive way. * lisp/dnd.el (dnd-last-dragged-remote-file): Allow list values as well. (dnd-remove-last-dragged-remote-file): Handle list values. (dnd-begin-file-drag): Fix file name expansion. (dnd-begin-drag-files): New function. * lisp/select.el (xselect-convert-to-filename): Handle mutiple files (a vector of file names):.
Diffstat (limited to 'lisp/select.el')
-rw-r--r--lisp/select.el20
1 files changed, 16 insertions, 4 deletions
diff --git a/lisp/select.el b/lisp/select.el
index 01e002db709..df1d4026552 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -628,10 +628,22 @@ two markers or an overlay. Otherwise, it is nil."
(if (not (eq selection 'XdndSelection))
(when (setq value (xselect--selection-bounds value))
(xselect--encode-string 'TEXT (buffer-file-name (nth 2 value))))
- (when (and (stringp value)
- (file-exists-p value))
- (xselect--encode-string 'TEXT (expand-file-name value)
- nil t))))
+ (if (and (stringp value)
+ (file-exists-p value))
+ (xselect--encode-string 'TEXT (expand-file-name value)
+ nil t)
+ (when (vectorp value)
+ (with-temp-buffer
+ (cl-loop for file across value
+ do (progn (insert (encode-coding-string
+ (expand-file-name file)
+ file-name-coding-system))
+ (insert "\0")))
+ ;; Get rid of the last NULL byte.
+ (when (> (point) 1)
+ (delete-char -1))
+ ;; Motif wants STRING.
+ (cons 'STRING (buffer-string)))))))
(defun xselect-convert-to-charpos (_selection _type value)
(when (setq value (xselect--selection-bounds value))