]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle quitting correctly during interprogram drag-and-drop
authorPo Lu <luangruo@yahoo.com>
Wed, 23 Mar 2022 03:30:13 +0000 (11:30 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 23 Mar 2022 03:30:13 +0000 (11:30 +0800)
* lisp/mouse.el (mouse-drag-and-drop-region): Handle quit
correctly by exiting the cross program drag and drop.

lisp/mouse.el

index 30b19510a46016ce1cfa3d76dfa3a6371d520544..381fc0c47e8ceb9085790e52a3d0df8ede90a0cb 100644 (file)
@@ -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))