1523 |
(setq dired-switches-alist nil) |
(setq dired-switches-alist nil) |
1524 |
(dired-sort-other dired-actual-switches t) |
(dired-sort-other dired-actual-switches t) |
1525 |
(run-mode-hooks 'dired-mode-hook) |
(run-mode-hooks 'dired-mode-hook) |
1526 |
(when (featurep 'x-dnd) |
(when (featurep 'dnd) |
1527 |
(make-variable-buffer-local 'x-dnd-test-function) |
(make-variable-buffer-local 'dnd-protocol-alist) |
1528 |
(make-variable-buffer-local 'x-dnd-protocol-alist) |
(setq dnd-protocol-alist |
|
(setq x-dnd-test-function 'dired-dnd-test-function) |
|
|
(setq x-dnd-protocol-alist |
|
1529 |
(append '(("^file:///" . dired-dnd-handle-local-file) |
(append '(("^file:///" . dired-dnd-handle-local-file) |
1530 |
("^file://" . dired-dnd-handle-file) |
("^file://" . dired-dnd-handle-file) |
1531 |
("^file:" . dired-dnd-handle-local-file)) |
("^file:" . dired-dnd-handle-local-file)) |
1532 |
x-dnd-protocol-alist)))) |
dnd-protocol-alist)))) |
1533 |
|
|
1534 |
;; Idiosyncratic dired commands that don't deal with marks. |
;; Idiosyncratic dired commands that don't deal with marks. |
1535 |
|
|
3134 |
(const :tag "Copy directories without asking" always)) |
(const :tag "Copy directories without asking" always)) |
3135 |
:group 'dired) |
:group 'dired) |
3136 |
|
|
|
(defun dired-dnd-test-function (window action types) |
|
|
"The test function for drag and drop into dired buffers. |
|
|
WINDOW is where the mouse is when this function is called. It may be a frame |
|
|
if the mouse is over the menu bar, scroll bar or tool bar. |
|
|
ACTION is the suggested action from the source, and TYPES are the |
|
|
types the drop data can have. This function only accepts drops with |
|
|
types in `x-dnd-known-types'. It returns the action suggested by the source." |
|
|
(let ((type (x-dnd-choose-type types))) |
|
|
(if type |
|
|
(cons action type) |
|
|
nil))) |
|
|
|
|
3137 |
(defun dired-dnd-popup-notice () |
(defun dired-dnd-popup-notice () |
3138 |
(x-popup-dialog |
(x-popup-dialog |
3139 |
t |
t |
3162 |
URI is the file to handle, ACTION is one of copy, move, link or ask. |
URI is the file to handle, ACTION is one of copy, move, link or ask. |
3163 |
Ask means pop up a menu for the user to select one of copy, move or link." |
Ask means pop up a menu for the user to select one of copy, move or link." |
3164 |
(require 'dired-aux) |
(require 'dired-aux) |
3165 |
(let* ((from (x-dnd-get-local-file-name uri t)) |
(let* ((from (dnd-get-local-file-name uri t)) |
3166 |
(to (if from (concat (dired-current-directory) |
(to (if from (concat (dired-current-directory) |
3167 |
(file-name-nondirectory from)) |
(file-name-nondirectory from)) |
3168 |
nil))) |
nil))) |
3200 |
URI is the file to handle. If the hostname in the URI isn't local, do nothing. |
URI is the file to handle. If the hostname in the URI isn't local, do nothing. |
3201 |
ACTION is one of copy, move, link or ask. |
ACTION is one of copy, move, link or ask. |
3202 |
Ask means pop up a menu for the user to select one of copy, move or link." |
Ask means pop up a menu for the user to select one of copy, move or link." |
3203 |
(let ((local-file (x-dnd-get-local-file-uri uri))) |
(let ((local-file (dnd-get-local-file-uri uri))) |
3204 |
(if local-file (dired-dnd-handle-local-file local-file action) |
(if local-file (dired-dnd-handle-local-file local-file action) |
3205 |
nil))) |
nil))) |
3206 |
|
|