diff options
| -rw-r--r-- | lisp/x-dnd.el | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index 760dd0a42bf..13fe3842f18 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el | |||
| @@ -1544,41 +1544,39 @@ was taken, or the direct save failed." | |||
| 1544 | (x-dnd-use-offix-drop nil) | 1544 | (x-dnd-use-offix-drop nil) |
| 1545 | (x-dnd-use-unsupported-drop nil) | 1545 | (x-dnd-use-unsupported-drop nil) |
| 1546 | (prop-deleted nil) | 1546 | (prop-deleted nil) |
| 1547 | (action nil) | ||
| 1548 | encoded-name) | 1547 | encoded-name) |
| 1549 | (unwind-protect | 1548 | (unwind-protect |
| 1550 | (setq action | 1549 | (progn |
| 1551 | (progn | 1550 | (when (file-remote-p file) |
| 1552 | (when (file-remote-p file) | 1551 | (setq file-name (file-local-copy file)) |
| 1553 | (setq file-name (file-local-copy file)) | 1552 | (setq dnd-last-dragged-remote-file file-name) |
| 1554 | (setq dnd-last-dragged-remote-file file-name) | 1553 | (add-hook 'kill-emacs-hook |
| 1555 | (add-hook 'kill-emacs-hook | 1554 | #'dnd-remove-last-dragged-remote-file)) |
| 1556 | #'dnd-remove-last-dragged-remote-file)) | 1555 | (setq encoded-name |
| 1557 | (setq encoded-name | 1556 | (encode-coding-string name |
| 1558 | (encode-coding-string name | 1557 | (or file-name-coding-system |
| 1559 | (or file-name-coding-system | 1558 | default-file-name-coding-system))) |
| 1560 | default-file-name-coding-system))) | 1559 | (setq x-dnd-xds-current-file file-name) |
| 1561 | (setq x-dnd-xds-current-file file-name) | 1560 | (x-change-window-property "XdndDirectSave0" encoded-name |
| 1562 | (x-change-window-property "XdndDirectSave0" encoded-name | 1561 | frame "text/plain" 8 nil) |
| 1563 | frame "text/plain" 8 nil) | 1562 | (gui-set-selection 'XdndSelection (concat "file://" file-name)) |
| 1564 | (gui-set-selection 'XdndSelection (concat "file://" file-name)) | 1563 | ;; FIXME: this does not work with GTK file managers, |
| 1565 | ;; FIXME: this does not work with GTK file managers, | 1564 | ;; since they always reach for `text/uri-list' first, |
| 1566 | ;; since they always reach for `text/uri-list' first, | 1565 | ;; contrary to the spec. |
| 1567 | ;; contrary to the spec. | 1566 | (let ((action (x-begin-drag '("XdndDirectSave0" "text/uri-list" |
| 1568 | (let ((action (x-begin-drag '("XdndDirectSave0" "text/uri-list" | 1567 | "application/octet-stream") |
| 1569 | "application/octet-stream") | 1568 | 'XdndActionDirectSave |
| 1570 | 'XdndActionDirectSave | 1569 | frame nil allow-same-frame))) |
| 1571 | frame nil allow-same-frame))) | 1570 | (if (not x-dnd-xds-performed) |
| 1572 | (if (not x-dnd-xds-performed) | 1571 | action |
| 1573 | action | 1572 | (let ((property (x-window-property "XdndDirectSave0" frame |
| 1574 | (let ((property (x-window-property "XdndDirectSave0" frame | 1573 | "AnyPropertyType" nil t))) |
| 1575 | "AnyPropertyType" nil t))) | 1574 | (setq prop-deleted t) |
| 1576 | (setq prop-deleted t) | 1575 | ;; "System-G" deletes the property upon success. |
| 1577 | ;; "System-G" deletes the property upon success. | 1576 | (and (or (null property) |
| 1578 | (and (or (null property) | 1577 | (and (stringp property) |
| 1579 | (and (stringp property) | 1578 | (not (equal property "")))) |
| 1580 | (not (equal property "")))) | 1579 | action))))) |
| 1581 | action)))))) | ||
| 1582 | (unless prop-deleted | 1580 | (unless prop-deleted |
| 1583 | (x-delete-window-property "XdndDirectSave0" frame)) | 1581 | (x-delete-window-property "XdndDirectSave0" frame)) |
| 1584 | ;; Delete any remote copy that was made. | 1582 | ;; Delete any remote copy that was made. |