summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-06-06 19:05:36 +0800
committerPo Lu <luangruo@yahoo.com>2022-06-06 19:07:07 +0800
commitc3127f56387441fce09a1103324b923f55695109 (patch)
treea50a27dab5e0906ac2a4a4684033ba1a65aab6f3
parent138d2f22f731bc3faf6de26b67e2b50ce9131541 (diff)
downloademacs-c3127f56387441fce09a1103324b923f55695109.tar.gz
Improve handling of remote files during drag-and-drop
* lisp/dnd.el (dnd-begin-drag-files): Don't fail if one remote file couldn't be downloaded.
-rw-r--r--lisp/dnd.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 14d80ac6c57..0f65b5228d6 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -469,9 +469,16 @@ FILES will be dragged."
(when (file-remote-p (car tem))
(when (eq action 'link)
(error "Cannot create symbolic link to remote file"))
- (setcar tem (file-local-copy (car tem)))
- (push (car tem) dnd-last-dragged-remote-file))
+ (condition-case error
+ (progn (setcar tem (file-local-copy (car tem)))
+ (push (car tem) dnd-last-dragged-remote-file))
+ (error (message "Failed to download file: %s" error)
+ (setcar tem nil))))
(setq tem (cdr tem)))
+ ;; Remove any files that failed to download from a remote host.
+ (setq new-files (delq nil new-files))
+ (unless new-files
+ (error "No files were specified or no remote file could be downloaded"))
(unless action
(setq action 'copy))
(gui-set-selection 'XdndSelection