1567 |
"Edit the files listed in the drag-n-drop EVENT. |
"Edit the files listed in the drag-n-drop EVENT. |
1568 |
Switch to a buffer editing the last file dropped." |
Switch to a buffer editing the last file dropped." |
1569 |
(interactive "e") |
(interactive "e") |
1570 |
(save-excursion |
;; Make sure the drop target has positive co-ords |
1571 |
;; Make sure the drop target has positive co-ords |
;; before setting the selected frame - otherwise it |
1572 |
;; before setting the selected frame - otherwise it |
;; won't work. <skx@tardis.ed.ac.uk> |
1573 |
;; won't work. <skx@tardis.ed.ac.uk> |
(let* ((window (posn-window (event-start event))) |
1574 |
(let* ((window (posn-window (event-start event))) |
(coords (posn-x-y (event-start event))) |
1575 |
(coords (posn-x-y (event-start event))) |
(x (car coords)) |
1576 |
(x (car coords)) |
(y (cdr coords))) |
1577 |
(y (cdr coords))) |
(if (and (> x 0) (> y 0)) |
1578 |
(if (and (> x 0) (> y 0)) |
(set-frame-selected-window nil window)) |
1579 |
(set-frame-selected-window nil window)) |
(mapcar (lambda (file-name) |
1580 |
(mapcar (lambda (file-name) |
(if (listp file-name) |
1581 |
(x-dnd-handle-one-url window 'private |
(let ((line (car file-name)) |
1582 |
(concat "file:" file-name))) |
(start (car (cdr file-name))) |
1583 |
(car (cdr (cdr event))))) |
(end (car (cdr (cdr file-name))))) |
1584 |
(raise-frame))) |
(if (> line 0) |
1585 |
|
(goto-line line) |
1586 |
|
(if (and (> start 0) (> end 0)) |
1587 |
|
(progn (set-mark start) |
1588 |
|
(goto-char end))))) |
1589 |
|
(x-dnd-handle-one-url window 'private |
1590 |
|
(concat "file:" file-name)))) |
1591 |
|
(car (cdr (cdr event))))) |
1592 |
|
(raise-frame)) |
1593 |
|
|
1594 |
(global-set-key [drag-n-drop] 'mac-drag-n-drop) |
(global-set-key [drag-n-drop] 'mac-drag-n-drop) |
1595 |
|
|