Drag-and-drop FROM Emacs to another editable application window under MacOS

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Drag-and-drop FROM Emacs to another editable application window under MacOS

Robert Weiner-2
Has anyone ever worked on being able to drag files and regions from Emacs to another Mac application?

I'd like to be able to:

1. Drag files from Dired to an editable window in another application, e.g. Chrome.

2. Select a region and have a mouse key binding that would drag it to the other application.

Thanks for any pointers.

Bob

Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

Tak Kunihiro-3
> Has anyone ever worked on being able to drag files and regions from
> Emacs to another Mac application?
>
> I'd like to be able to:
> 1. Drag files from Dired to an editable window in another application, e.g. Chrome.
> 2. Select a region and have a mouse key binding that would drag it to the other application.

`mouse-drag-and-drop-region' (from 26) moves region within a frame.
HTH

Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

Robert Weiner-2
On Wed, Oct 11, 2017 at 4:40 PM, Tak Kunihiro <[hidden email]> wrote:
​I wrote:
 
> I'd like to be able to:
> 1. Drag files from Dired to an editable window in another application, e.g. Chrome.
> 2. Select a region and have a mouse key binding that would drag it to the other application.

`mouse-drag-and-drop-region' (from 26) moves region within a frame.

​Excellent.  Thanks for the tip.  Some things I'm working on now will probably allow this to be extended across frames.

I wonder why it doesn't work to drop the text onto other applications.

Bob

Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

Eli Zaretskii
> From: Robert Weiner <[hidden email]>
> Date: Wed, 11 Oct 2017 19:07:47 -0400
> Cc: emacs-devel <[hidden email]>
>
> I wonder why it doesn't work to drop the text onto other applications.

It does, but the application you drag-n-drop into should support that.

Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

Robert Weiner-2
On Thu, Oct 12, 2017 at 3:01 AM, Eli Zaretskii <[hidden email]> wrote:
> From: Robert Weiner <[hidden email]>
> Date: Wed, 11 Oct 2017 19:07:47 -0400
> Cc: emacs-devel <[hidden email]>
>
> I wonder why it doesn't work to drop the text onto other applications.

It does, but the application you drag-n-drop into should support that.

​On a Mac:

I highlight text in Evernote and drag it into a Chrome Gmail composition window.  It drops right in without a problem.

I enable text drag-n-drop in Emacs 27 and highlight some text to try to drag it to the same Chrome window.  A yellow rectangle of text starts to drag but freezes right as the mouse pointer leaves the Emacs frame, so I can't drag it any further.

Bob


Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

Eli Zaretskii
> From: Robert Weiner <[hidden email]>
> Date: Thu, 12 Oct 2017 03:13:37 -0400
> Cc: Tak Kunihiro <[hidden email]>, emacs-devel <[hidden email]>
>
> ​On a Mac:
>
> I highlight text in Evernote and drag it into a Chrome Gmail composition window.  It drops right in without a
> problem.
>
> I enable text drag-n-drop in Emacs 27 and highlight some text to try to drag it to the same Chrome window.  A
> yellow rectangle of text starts to drag but freezes right as the mouse pointer leaves the Emacs frame, so I
> can't drag it any further.

Maybe I was confused, and we only support drag-n-drop _into_ Emacs.

Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

martin rudalics
In reply to this post by Robert Weiner-2
 > I wonder why it doesn't work to drop the text onto other applications.

Probably because there's no standard protocol to drag and drop anything
but files between different applications.

martin

Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

Robert Weiner-2
On Thu, Oct 12, 2017 at 4:05 AM, martin rudalics <[hidden email]> wrote:
> I wonder why it doesn't work to drop the text onto other applications.

Probably because there's no standard protocol to drag and drop anything
​​
but files between different applications.
​​
Maybe not for every window system but on MacOS there is and many applications accept dragged text directly:
​​

So this could be an addition to the macOS-specific drag-n-drop support.

Bob

Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

Tak Kunihiro-3
>  > I wonder why it doesn't work to drop the text onto other applications.
>
>  Probably because there's no standard protocol to drag and drop anything
>  ​​but files between different applications.
>
> ​​Maybe not for every window system but on MacOS there is and many applications accept dragged text
> directly:
> ​​https://developer.apple.com/documentation/uikit/drag_and_drop/making_a_view_into_a_drag_source
> ​ - source info​

For now `mouse-drag-and-drop-region' does nothing when
(event-end (read-event)) is toward out of the current frame.

I think the first step is to revise `mouse-drag-and-drop-region' to let
it drag text to a different frame.


Reply | Threaded
Open this post in threaded view
|

Re: Drag-and-drop FROM Emacs to another editable application window under MacOS

Robert Weiner-2
On Thu, Oct 12, 2017 at 10:19 AM, Tak Kunihiro <[hidden email]> wrote:
>  > I wonder why it doesn't work to drop the text onto other applications.
>
>  Probably because there's no standard protocol to drag and drop anything
>  ​​but files between different applications.
>
> ​​Maybe not for every window system but on MacOS there is and many applications accept dragged text
> directly:
> ​​https://developer.apple.com/documentation/uikit/drag_and_drop/making_a_view_into_a_drag_source
> ​ - source info​

For now `mouse-drag-and-drop-region' does nothing when
(event-end (read-event)) is toward out of the current frame.

I think the first step is to revise `mouse-drag-and-drop-region' to let
it drag text to a different frame.

​So I have fixed that as you can see in my prior message.  Now what must be done to allow Emacs to drop the text onto another Mac application that accepts dropped text?

Bob