From 8aff4c0a366f060595dd6360e7a008585b7eb405 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 23 Mar 2022 11:30:13 +0800 Subject: [PATCH] Handle quitting correctly during interprogram drag-and-drop * lisp/mouse.el (mouse-drag-and-drop-region): Handle quit correctly by exiting the cross program drag and drop. --- lisp/mouse.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/mouse.el b/lisp/mouse.el index 30b19510a46..381fc0c47e8 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -3119,13 +3119,15 @@ is copied instead of being cut." (mouse-drag-and-drop-region-hide-tooltip) (gui-set-selection 'XdndSelection value-selection) (let ((drag-action-or-frame - (x-begin-drag '("UTF8_STRING" "text/plain" - "text/plain;charset=utf-8" - "STRING" "TEXT" "COMPOUND_TEXT") - (if mouse-drag-and-drop-region-cut-when-buffers-differ - 'XdndActionMove - 'XdndActionCopy) - (posn-window (event-end event)) t))) + (condition-case nil + (x-begin-drag '("UTF8_STRING" "text/plain" + "text/plain;charset=utf-8" + "STRING" "TEXT" "COMPOUND_TEXT") + (if mouse-drag-and-drop-region-cut-when-buffers-differ + 'XdndActionMove + 'XdndActionCopy) + (posn-window (event-end event)) t) + (quit nil)))) (when (framep drag-action-or-frame) (throw 'drag-again nil)) -- 2.39.5