Mercurial > emacs
comparison lisp/term/mac-win.el @ 59199:d6563f85d9e5
* macterm.c (SelectionRange): Add Xcode position apple event struct.
(do_ae_open_documents): Handle Xcode-style file position open
events.
* term/mac-win.el (mac-drag-n-drop): Handle drag-n-drop events
that include line numbers.
author | Steven Tamm <steventamm@mac.com> |
---|---|
date | Thu, 30 Dec 2004 02:04:31 +0000 |
parents | 60ffced08532 |
children | 9078a74f1daf 95879cc1ed20 |
comparison
equal
deleted
inserted
replaced
59198:f7d2264f4990 | 59199:d6563f85d9e5 |
---|---|
1565 | 1565 |
1566 (defun mac-drag-n-drop (event) | 1566 (defun mac-drag-n-drop (event) |
1567 "Edit the files listed in the drag-n-drop EVENT. | 1567 "Edit the files listed in the drag-n-drop EVENT. |
1568 Switch to a buffer editing the last file dropped." | 1568 Switch to a buffer editing the last file dropped." |
1569 (interactive "e") | 1569 (interactive "e") |
1570 (save-excursion | 1570 ;; Make sure the drop target has positive co-ords |
1571 ;; Make sure the drop target has positive co-ords | 1571 ;; before setting the selected frame - otherwise it |
1572 ;; before setting the selected frame - otherwise it | 1572 ;; won't work. <skx@tardis.ed.ac.uk> |
1573 ;; won't work. <skx@tardis.ed.ac.uk> | 1573 (let* ((window (posn-window (event-start event))) |
1574 (let* ((window (posn-window (event-start event))) | 1574 (coords (posn-x-y (event-start event))) |
1575 (coords (posn-x-y (event-start event))) | 1575 (x (car coords)) |
1576 (x (car coords)) | 1576 (y (cdr coords))) |
1577 (y (cdr coords))) | 1577 (if (and (> x 0) (> y 0)) |
1578 (if (and (> x 0) (> y 0)) | 1578 (set-frame-selected-window nil window)) |
1579 (set-frame-selected-window nil window)) | 1579 (mapcar (lambda (file-name) |
1580 (mapcar (lambda (file-name) | 1580 (if (listp file-name) |
1581 (x-dnd-handle-one-url window 'private | 1581 (let ((line (car file-name)) |
1582 (concat "file:" file-name))) | 1582 (start (car (cdr file-name))) |
1583 (car (cdr (cdr event))))) | 1583 (end (car (cdr (cdr file-name))))) |
1584 (raise-frame))) | 1584 (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)) | |
1585 | 1593 |
1586 (global-set-key [drag-n-drop] 'mac-drag-n-drop) | 1594 (global-set-key [drag-n-drop] 'mac-drag-n-drop) |
1587 | 1595 |
1588 ;; By checking whether the variable mac-ready-for-drag-n-drop has been | 1596 ;; By checking whether the variable mac-ready-for-drag-n-drop has been |
1589 ;; defined, the event loop in macterm.c can be informed that it can | 1597 ;; defined, the event loop in macterm.c can be informed that it can |