summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-07-24 21:32:42 +0800
committerPo Lu <luangruo@yahoo.com>2022-07-24 21:33:42 +0800
commit295efb60257d6eefa5d570009f4de3f6088af25e (patch)
tree78ef55a20d67cfb7eb3847a154bc7ffa602faaf4 /lisp
parent2024136d31e85f5935e1dd1a494ecb3ea715ef80 (diff)
downloademacs-295efb60257d6eefa5d570009f4de3f6088af25e.tar.gz
emacs-295efb60257d6eefa5d570009f4de3f6088af25e.tar.bz2
emacs-295efb60257d6eefa5d570009f4de3f6088af25e.zip
Throw errors in XDS handler directly
* lisp/x-dnd.el (x-dnd-xds-testing): New defvar. (x-dnd-handle-direct-save): Signal errors directly if it is true. * test/lisp/x-dnd-tests.el (x-dnd-xds-testing): New defvar. (x-dnd-tests-do-direct-save-internal): Bind it to t around x-begin-drag. (bug#56712)
Diffstat (limited to 'lisp')
-rw-r--r--lisp/x-dnd.el22
1 files changed, 18 insertions, 4 deletions
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index a61905cfac0..10fd9e5dac3 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -1442,6 +1442,11 @@ ACTION is the action given to `x-begin-drag'."
(defvar x-dnd-disable-motif-protocol)
(defvar x-dnd-use-unsupported-drop)
+(defvar x-dnd-xds-testing nil
+ "Whether or not XDS is being tested from ERT.
+When non-nil, throw errors from the `XdndDirectSave0' converters
+instead of returning \"E\".")
+
(defun x-dnd-handle-direct-save (_selection _type _value)
"Handle a selection request for `XdndDirectSave'."
(setq x-dnd-xds-performed t)
@@ -1456,15 +1461,24 @@ ACTION is the action given to `x-begin-drag'."
(dnd-get-local-file-name local-file-uri))))
(if (not local-name)
'(STRING . "F")
- (condition-case nil
- (progn
+ ;; We want errors to be signalled immediately during ERT
+ ;; testing, instead of being silently handled. (bug#56712)
+ (if x-dnd-xds-testing
+ (prog1 '(STRING . "S")
(copy-file x-dnd-xds-current-file
local-name t)
(when (equal x-dnd-xds-current-file
dnd-last-dragged-remote-file)
(dnd-remove-last-dragged-remote-file)))
- (:success '(STRING . "S"))
- (error '(STRING . "E"))))))
+ (condition-case nil
+ (progn
+ (copy-file x-dnd-xds-current-file
+ local-name t)
+ (when (equal x-dnd-xds-current-file
+ dnd-last-dragged-remote-file)
+ (dnd-remove-last-dragged-remote-file)))
+ (:success '(STRING . "S"))
+ (error '(STRING . "E")))))))
(defun x-dnd-handle-octet-stream (_selection _type _value)
"Handle a selecton request for `application/octet-stream'.