Variable: dired-mouse-drag-files

dired-mouse-drag-files is a customizable variable defined in dired.el.gz.

Value

nil

Documentation

If non-nil, allow the mouse to drag files from inside a Dired buffer.

Dragging the mouse and then releasing it over the window of another program will result in that program opening or creating a copy of the file underneath the mouse pointer (or all marked files if it was marked). This feature is supported only on X Windows, Haiku, and Nextstep (macOS or GNUstep).

If the value is link, then a symbolic link will be created to the file instead by the other program (usually a file manager).

If the value is move, then the default action will be for the other program to move the file to a different location. For this to work optimally, auto-revert-mode(var)/auto-revert-mode(fun) should be enabled in the Dired buffer.

If the Meta key is held down when the mouse button is pressed, then this will always be equivalent to link.

If the Control key is held down when the mouse button is pressed, then dragging the file will always copy it to the new location.

If the Shift key is held down when the mouse button is pressed, then this will always be equivalent to move.

This variable was added, or its default value changed, in Emacs 29.1.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defcustom dired-mouse-drag-files nil
  "If non-nil, allow the mouse to drag files from inside a Dired buffer.
Dragging the mouse and then releasing it over the window of
another program will result in that program opening or creating a
copy of the file underneath the mouse pointer (or all marked
files if it was marked).  This feature is supported only on X
Windows, Haiku, and Nextstep (macOS or GNUstep).

If the value is `link', then a symbolic link will be created to
the file instead by the other program (usually a file manager).

If the value is `move', then the default action will be for the
other program to move the file to a different location.  For this
to work optimally, `auto-revert-mode' should be enabled in the
Dired buffer.

If the Meta key is held down when the mouse button is pressed,
then this will always be equivalent to `link'.

If the Control key is held down when the mouse button is pressed,
then dragging the file will always copy it to the new location.

If the Shift key is held down when the mouse button is pressed,
then this will always be equivalent to `move'."
  :set (lambda (option value)
         (set-default option value)
         (dolist (buffer (buffer-list))
           (with-current-buffer buffer
             (when (derived-mode-p 'dired-mode)
               (revert-buffer nil t)))))
  :type '(choice (const :tag "Don't allow dragging" nil)
                 (const :tag "Copy file to new location" t)
                 (const :tag "Move file to new location" move)
                 (const :tag "Create symbolic link to file" link))
  :group 'dired
  :version "29.1")