Function: x-dnd-save-direct-immediately
x-dnd-save-direct-immediately is a byte-compiled function defined in
x-dnd.el.gz.
Signature
(x-dnd-save-direct-immediately NEED-NAME FILENAME)
Documentation
Handle dropping a file FILENAME that should be saved first.
Like x-dnd-save-direct, but do not prompt for the file name;
instead, return its absolute file name for saving in the current
directory.
This function is intended to be the value of x-dnd-direct-save-function,
which see.
Source Code
;; Defined in /usr/src/emacs/lisp/x-dnd.el.gz
(defun x-dnd-save-direct-immediately (need-name filename)
"Handle dropping a file FILENAME that should be saved first.
Like `x-dnd-save-direct', but do not prompt for the file name;
instead, return its absolute file name for saving in the current
directory.
This function is intended to be the value of `x-dnd-direct-save-function',
which see."
(if need-name
(let ((file-name (expand-file-name filename)))
(when (file-exists-p file-name)
(unless (y-or-n-p (format-message
"File `%s' exists; overwrite? " file-name))
(setq file-name nil)))
file-name)
;; TODO: move this to dired.el once a platform-agonistic
;; interface can be found.
(if (derived-mode-p 'dired-mode)
(revert-buffer)
(find-file filename))))