Next: , Previous: , Up: Frames   [Contents][Index]

30.21 Drag and Drop

When a user drags something from another application over Emacs, that other application expects Emacs to tell it if Emacs can handle the data that is dragged. The variable x-dnd-test-function is used by Emacs to determine what to reply. The default value is x-dnd-default-test-function which accepts drops if the type of the data to be dropped is present in x-dnd-known-types. You can customize x-dnd-test-function and/or x-dnd-known-types if you want Emacs to accept or reject drops based on some other criteria.

If you want to change the way Emacs handles drop of different types or add a new type, customize x-dnd-types-alist. This requires detailed knowledge of what types other applications use for drag and drop.

When an URL is dropped on Emacs it may be a file, but it may also be another URL type (https, etc.). Emacs first checks dnd-protocol-alist to determine what to do with the URL. If there is no match there, Emacs looks for a match in browse-url-handlers and browse-url-default-handlers. If still no match has been found, the text for the URL is inserted. If you want to alter Emacs behavior, you can customize these variables.