Variable: x-dnd-direct-save-function

x-dnd-direct-save-function is a customizable variable defined in x-dnd.el.gz.

Value

x-dnd-save-direct

Documentation

Function called when a file is dropped via XDS protocol.

The value should be a function of two arguments that supports the X Direct Save (XDS) protocol. The function will be called twice during the protocol execution.

When the function is called with the first argument non-nil, it should return an absolute file name whose base name is the value of the second argument, a string. The return value is the file name for the dragged file to be saved. The function can also return nil if saving the file should be refused for some reason; in that case the drop will be canceled.

When the function is called with the first argument nil, the second argument specifies the file name where the file was saved; the function should then do whatever is appropriate when such a file is saved, like show the file in the Dired buffer or visit the file.

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

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/x-dnd.el.gz
(defcustom x-dnd-direct-save-function #'x-dnd-save-direct
  "Function called when a file is dropped via XDS protocol.
The value should be a function of two arguments that supports
the X Direct Save (XDS) protocol.  The function will be called
twice during the protocol execution.

When the function is called with the first argument non-nil,
it should return an absolute file name whose base name is
the value of the second argument, a string.  The return value
is the file name for the dragged file to be saved.  The function
can also return nil if saving the file should be refused for some
reason; in that case the drop will be canceled.

When the function is called with the first argument nil, the
second argument specifies the file name where the file was saved;
the function should then do whatever is appropriate when such a
file is saved, like show the file in the Dired buffer or visit
the file."
  :version "29.1"
  :type '(choice (const :tag "Prompt for file name to save"
                        x-dnd-save-direct)
                 (const :tag "Save in `default-directory' without prompting"
                        x-dnd-save-direct-immediately)
                 (function :tag "Other function"))
  :group 'x)