On Mon, Oct 16, 2017 at 9:45 AM, Robert Weiner wrote: > On Fri, Oct 13, 2017 at 5:57 AM, Tak Kunihiro > wrote: > >> I tried the revised `mouse-drag-and-drop-region' on Emacs -Q 26.0.90 on >> macOS 10.9.5. I can drag text within a frame but cannot do so among >> frames. I think I miss something. Do you have idea? >> > > ​The yellow visual rectangle of the text being dragged seems to get stuck > at the source frame but if you continue your drag and release in another > frame with a non-read-only buffer, your text should be properly dropped > there. Is this what you did? Try it a couple different times to ensure > there is not some initialization warm up problem. > ​I see the issue now; the standard Emacs code does not handle cross-frame drags well. Replace the mouse-set-point function from mouse.el with the version below and then the yellow rectangle of text will follow you to the drag release frame and your drag-and-drops should work as you expect (with the mouse-drag-and-drop-region changes from before). -- Bob​ (defun mouse-set-point (event &optional promote-to-region) "Move point to the position clicked on with the mouse. This should be bound to a mouse click event type. If PROMOTE-TO-REGION is non-nil and event is a multiple-click, select the corresponding element around point, with the resulting position of point determined by `mouse-select-region-move-to-beginning'." (interactive "e\np") (let ((start-w-or-f (posn-window (event-start event))) (end-w-or-f (posn-window (event-end event)))) (if (framep start-w-or-f) (with-selected-frame start-w-or-f (setq start-w-or-f (selected-window)))) (if (framep end-w-or-f) (with-selected-frame end-w-or-f (setq end-w-or-f (selected-window)))) (if (and (window-minibuffer-p start-w-or-f) (not (minibuffer-window-active-p start-w-or-f))) ;; Select the ending frame only, not the window pressed within. (select-frame (window-frame end-w-or-f)) ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) (if (and promote-to-region (> (event-click-count event) 1)) (progn (mouse-set-region event) (when (and (boundp 'mouse-select-region-move-to-beginning) mouse-select-region-move-to-beginning) (when (> (posn-point (event-start event)) (region-beginning)) (exchange-point-and-mark)))) ;; Use event-end in case called from mouse-drag-region. ;; If EVENT is a click, event-end and event-start give same value. (if (and (window-minibuffer-p end-w-or-f) (not (minibuffer-window-active-p end-w-or-f))) ;; Select the ending frame only, not the window pressed within. (select-frame (window-frame end-w-or-f)) (condition-case () (posn-set-point (event-end event)) (error (select-frame (window-frame end-w-or-f)))))))))