From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Weiner Newsgroups: gmane.emacs.devel Subject: Re: Emacs 26: Code that fixes mouse-drag-and-drop-region to work across frames Date: Thu, 26 Oct 2017 18:07:45 -0400 Message-ID: References: <86d15rjrpe.fsf@misasa.okayama-u.ac.jp> <86tvywotlz.fsf@misasa.okayama-u.ac.jp> Reply-To: rswgnu@gmail.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c12576eb8471e055c7a6858" X-Trace: blaine.gmane.org 1509055718 13311 195.159.176.226 (26 Oct 2017 22:08:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 26 Oct 2017 22:08:38 +0000 (UTC) Cc: emacs-devel To: Tak Kunihiro Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 27 00:08:29 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7qK4-0001c7-9H for ged-emacs-devel@m.gmane.org; Fri, 27 Oct 2017 00:08:20 +0200 Original-Received: from localhost ([::1]:54842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7qKB-0000P1-Cl for ged-emacs-devel@m.gmane.org; Thu, 26 Oct 2017 18:08:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7qK4-0000Ok-BK for emacs-devel@gnu.org; Thu, 26 Oct 2017 18:08:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7qK1-00066f-5R for emacs-devel@gnu.org; Thu, 26 Oct 2017 18:08:20 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7qK1-00066X-18 for emacs-devel@gnu.org; Thu, 26 Oct 2017 18:08:17 -0400 Original-Received: from mail-qt0-f180.google.com ([209.85.216.180]:50710) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1e7qK0-00042N-PO for emacs-devel@gnu.org; Thu, 26 Oct 2017 18:08:16 -0400 Original-Received: by mail-qt0-f180.google.com with SMTP id d9so6252512qtd.7 for ; Thu, 26 Oct 2017 15:08:16 -0700 (PDT) X-Gm-Message-State: AMCzsaVOfwU5tyTDpSkEcHifsZHCgI1UFjftTG3gsxbPDIgxmTvr2TDy N/Rv2GWH89ZMHn/tRDvfLfeVLtc/ZYtCDetut/c= X-Google-Smtp-Source: ABhQp+Q3zDrFTktqx+sxghMEPVs/ZgqibL4YgfofTeeQrUey2h36D03RAjG4dNzDIBPdW5FFTsj3KZziPbPV97wGYYI= X-Received: by 10.237.43.99 with SMTP id p90mr37997175qtd.171.1509055696224; Thu, 26 Oct 2017 15:08:16 -0700 (PDT) Original-Received: by 10.200.12.74 with HTTP; Thu, 26 Oct 2017 15:07:45 -0700 (PDT) In-Reply-To: <86tvywotlz.fsf@misasa.okayama-u.ac.jp> X-Gmail-Original-Message-ID: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219790 Archived-At: --94eb2c12576eb8471e055c7a6858 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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? > >> > > =E2=80=8BI 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? > =E2=80=8BSee if adding this fixes it: ;; From mouse-position: ;; f =3D 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))=E2=80=8B --94eb2c12576eb8471e055c7a6858 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Oct 18, 2= 017 at 8:43 PM, Tak Kunihiro <homeros.misasa@gmail.com> wrote:
>>>=C2=A0 I tried the revised `mouse-drag-and-d= rop-region' on Emacs -Q
>>>=C2=A0 26.0.90 on macOS 10.9.5. I can drag text within a frame = but cannot
>>>=C2=A0 do so among frames. I think I miss something. Do you hav= e idea?
>>
> =E2=80=8BI see the issue now; the standa= rd 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-126= 5.21 Version 10.9.5 (Build 13F1911)) of 2017-10-17
Emacs -Q

I cannot drag text among frames yet.=C2=A0 I think I still miss something.<= br> Can you show recipe that starts from emacs -Q?

= =E2=80=8BSee if adding this fixes it:

=C2=A0 =C2=A0 ;; From mouse-position:
=C2=A0 =C2=A0 ;;=C2=A0 =C2=A0 f =3D SELECTED_FRAME ();
<= div class=3D"gmail_default" style=3D"font-family:monospace,monospace"> =C2=A0 =C2=A0 ;;=C2=A0 =C2=A0 XSETFRAME = (lispy_dummy, f);
=C2=A0 =C2=A0 ;;= =C2=A0 It seems like the XSETFRAME macro is not properly copying the value = of f on initial frame selection under the macOS window system.
=C2=A0 =C2=A0 ;;=C2=A0 The problem occurs on o= ther systems as well, e.g. Emacs 25.2 under Windows 7.
=C2=A0 =C2=A0 ;;=C2=A0 The function below is a tempora= ry fix for this.
=C2=A0 =C2=A0 (se= tq mouse-position-function
=C2=A0= (lambda (frame-x-dot-y)
=C2=A0 = =C2=A0 "Under macOS, mouse-position and mouse-pixel-position sometimes= fail to return the selected-frame (returning the prior frame instead); fix= that here."
=C2=A0 =C2=A0 (= if frame-x-dot-y (setcar frame-x-dot-y (selected-frame)))
=C2=A0 =C2=A0 frame-x-dot-y))=E2=80=8B

--94eb2c12576eb8471e055c7a6858--