On Wed, Oct 18, 2017 at 8:43 PM, 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? > >> > > ​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 > > GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin13.4.0, NS appkit-1265.21 > Version 10.9.5 (Build 13F1911)) of 2017-10-17 > Emacs -Q > > I cannot drag text among frames yet. I think I still miss something. > Can you show recipe that starts from emacs -Q? > ​See if adding this fixes it: ;; From mouse-position: ;; f = SELECTED_FRAME (); ;; XSETFRAME (lispy_dummy, f); ;; It seems like the XSETFRAME macro is not properly copying the value of f on initial frame selection under the macOS window system. ;; The problem occurs on other systems as well, e.g. Emacs 25.2 under Windows 7. ;; The function below is a temporary fix for this. (setq mouse-position-function (lambda (frame-x-dot-y) "Under macOS, mouse-position and mouse-pixel-position sometimes fail to return the selected-frame (returning the prior frame instead); fix that here." (if frame-x-dot-y (setcar frame-x-dot-y (selected-frame))) frame-x-dot-y))​