diff options
| -rw-r--r-- | lisp/dired.el | 2 | ||||
| -rw-r--r-- | lisp/term/ns-win.el | 7 | ||||
| -rw-r--r-- | src/nsselect.m | 25 |
3 files changed, 32 insertions, 2 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index fbf26dbce7a..6ed4a949e0a 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -254,7 +254,7 @@ The target is used in the prompt for file copy, rename etc." | |||
| 254 | Dragging the mouse and then releasing it over the window of | 254 | Dragging the mouse and then releasing it over the window of |
| 255 | another program will result in that program opening the file, or | 255 | another program will result in that program opening the file, or |
| 256 | creating a copy of it. This feature is supported only on X | 256 | creating a copy of it. This feature is supported only on X |
| 257 | Windows and Haiku. | 257 | Windows, Haiku, and Nextstep (macOS or GNUstep). |
| 258 | 258 | ||
| 259 | If the value is `link', then a symbolic link will be created to | 259 | If the value is `link', then a symbolic link will be created to |
| 260 | the file instead by the other program (usually a file manager)." | 260 | the file instead by the other program (usually a file manager)." |
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index 42b8d72c269..b49143fbc20 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el | |||
| @@ -903,6 +903,13 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") | |||
| 903 | (when (and (member "STRING" targets) | 903 | (when (and (member "STRING" targets) |
| 904 | (stringp ns-dnd-selection-value)) | 904 | (stringp ns-dnd-selection-value)) |
| 905 | (push (cons 'string ns-dnd-selection-value) pasteboard)) | 905 | (push (cons 'string ns-dnd-selection-value) pasteboard)) |
| 906 | (when (and (member "FILE_NAME" targets) | ||
| 907 | (file-exists-p ns-dnd-selection-value)) | ||
| 908 | (push (cons 'file | ||
| 909 | (url-encode-url (concat "file://" | ||
| 910 | (expand-file-name | ||
| 911 | ns-dnd-selection-value)))) | ||
| 912 | pasteboard)) | ||
| 906 | (ns-begin-drag frame pasteboard action))) | 913 | (ns-begin-drag frame pasteboard action))) |
| 907 | 914 | ||
| 908 | (provide 'ns-win) | 915 | (provide 'ns-win) |
diff --git a/src/nsselect.m b/src/nsselect.m index a481e80d770..0bd840d92b7 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -561,17 +561,34 @@ static void | |||
| 561 | ns_decode_data_to_pasteboard (Lisp_Object type, Lisp_Object data, | 561 | ns_decode_data_to_pasteboard (Lisp_Object type, Lisp_Object data, |
| 562 | NSPasteboard *pasteboard) | 562 | NSPasteboard *pasteboard) |
| 563 | { | 563 | { |
| 564 | NSArray *types, *new; | ||
| 565 | |||
| 566 | types = [pasteboard types]; | ||
| 567 | |||
| 564 | CHECK_SYMBOL (type); | 568 | CHECK_SYMBOL (type); |
| 565 | 569 | ||
| 566 | if (EQ (type, Qstring)) | 570 | if (EQ (type, Qstring)) |
| 567 | { | 571 | { |
| 568 | CHECK_STRING (data); | 572 | CHECK_STRING (data); |
| 569 | 573 | ||
| 570 | [pasteboard declareTypes: [NSArray arrayWithObject: NSPasteboardTypeString] | 574 | new = [types arrayByAddingObject: NSPasteboardTypeString]; |
| 575 | |||
| 576 | [pasteboard declareTypes: new | ||
| 571 | owner: nil]; | 577 | owner: nil]; |
| 572 | [pasteboard setString: [NSString stringWithLispString: data] | 578 | [pasteboard setString: [NSString stringWithLispString: data] |
| 573 | forType: NSPasteboardTypeString]; | 579 | forType: NSPasteboardTypeString]; |
| 574 | } | 580 | } |
| 581 | else if (EQ (type, Qfile)) | ||
| 582 | { | ||
| 583 | CHECK_STRING (data); | ||
| 584 | |||
| 585 | new = [types arrayByAddingObject: NSPasteboardTypeFileURL]; | ||
| 586 | |||
| 587 | [pasteboard declareTypes: new | ||
| 588 | owner: nil]; | ||
| 589 | [pasteboard setString: [NSString stringWithLispString: data] | ||
| 590 | forType: NSPasteboardTypeFileURL]; | ||
| 591 | } | ||
| 575 | else | 592 | else |
| 576 | signal_error ("Unknown pasteboard type", type); | 593 | signal_error ("Unknown pasteboard type", type); |
| 577 | } | 594 | } |
| @@ -582,6 +599,9 @@ ns_lisp_to_pasteboard (Lisp_Object object, | |||
| 582 | { | 599 | { |
| 583 | Lisp_Object tem, type, data; | 600 | Lisp_Object tem, type, data; |
| 584 | 601 | ||
| 602 | [pasteboard declareTypes: [NSArray array] | ||
| 603 | owner: nil]; | ||
| 604 | |||
| 585 | CHECK_LIST (object); | 605 | CHECK_LIST (object); |
| 586 | for (tem = object; CONSP (tem); tem = XCDR (tem)) | 606 | for (tem = object; CONSP (tem); tem = XCDR (tem)) |
| 587 | { | 607 | { |
| @@ -642,6 +662,9 @@ the meaning of DATA: | |||
| 642 | - `string' means DATA should be a string describing text that will | 662 | - `string' means DATA should be a string describing text that will |
| 643 | be dragged to another program. | 663 | be dragged to another program. |
| 644 | 664 | ||
| 665 | - `file' means DATA should be a file URL that will be dragged to | ||
| 666 | another program. | ||
| 667 | |||
| 645 | ACTION is the action that will be taken by the drop target towards the | 668 | ACTION is the action that will be taken by the drop target towards the |
| 646 | data inside PBOARD. | 669 | data inside PBOARD. |
| 647 | 670 | ||