Jump to content

Drag and drop modifier keys


Recommended Posts

Hi all,

 

I start Alfred (3) with option-spacebar. If I then find a file, and drag and drop it into emacs, it doesn't pick it up as a drag-and-drop, but rather as an option-drag-and-drop. Is there some setting in Alfred I can change so that it releases the modifier key before performing the drag and drop?

 

Thanks!

 

Richard

Edited by Richard Garner
wrong keystrokes
Link to comment

Thanks! It seems that if I hold Control while dragging, then it registers as an unmodified drag-and-drop. However, holding down either Option or Apple makes no difference. Is it possible to change the defaults so that a drag and drop produces a plain vanilla unmodified drag and drop? (This is how it used to work in Alfred 2).

Link to comment

Alfred isn't simulating modifier keys when doing the file drag, he's using a standard macOS API call which simply implies "start a file drag with this path, from this location on the screen" and macOS takes care of the rest. The simple API call doesn't give you any control over this, as "default behaviour" is assumed.

 

Alfred isn't responsible for what happens when you drop, so it's treated as a file reference. The receiving app deals with the file as it sees appropriate:


Drag from Alfred to Mail (shows +): References file

Drag from Alfred to Finder (shows +): Copies file

Drag from Finder to Coda (doesn't show +): Moves file - Coda decides this behaviour

 

What actual behaviour are you seeing in emacs?

 

FWIW, Alfred moved away from using old deprecated drag code in Alfred 2, so a behaviour change may have been seen.

Link to comment

Thanks for the response. Here in more detail is what is going on.

 

In emacs, if I type C-h k (describe-key) I can then drag and drop something into the emacs window and see what keystroke this causes in emacs.

 

If I do C-h k and drag a file from an open finder window, I get the keystroke <drag-n-drop>. That is as it should be.

 

If I do C-h k and drag a file from Alfred, I get the keystroke <M-drag-n-drop>, which in emacs is usually bound to "drag and drop as text". In my common use case, I drag and drop into an email I am composing, but rather than attaching the file it inserts the path to the file. If I drag from a Finder window, it attaches the file as expected.

 

So it seems that the API call from Alfred does something different from the API call that would be made by dragging from a Finder window.

 

I can fix this by rebinding <M-drag-n-drop> to <drag-n-drop> in emacs but it's a kludge, and then <M-drag-n-drop> doesn't work elsewhere.

 

Thanks!

 

Richard

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...