Mercurial > emacs
changeset 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 | f7d2264f4990 |
children | a5d9000cf1cd |
files | lisp/ChangeLog lisp/term/mac-win.el src/ChangeLog src/macterm.c |
diffstat | 4 files changed, 53 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Dec 30 01:49:38 2004 +0000 +++ b/lisp/ChangeLog Thu Dec 30 02:04:31 2004 +0000 @@ -1,3 +1,8 @@ +2004-12-29 Sanghyuk Suh <han9kin@mac.com> + + * term/mac-win.el (mac-drag-n-drop): Handle drag-n-drop events + that include line numbers. + 2004-12-29 Milan Zamazal <pdm@zamazal.org> * files.el (hack-local-variables): If no PREFIX, set it to "^".
--- a/lisp/term/mac-win.el Thu Dec 30 01:49:38 2004 +0000 +++ b/lisp/term/mac-win.el Thu Dec 30 02:04:31 2004 +0000 @@ -1567,21 +1567,29 @@ "Edit the files listed in the drag-n-drop EVENT. Switch to a buffer editing the last file dropped." (interactive "e") - (save-excursion - ;; Make sure the drop target has positive co-ords - ;; before setting the selected frame - otherwise it - ;; won't work. <skx@tardis.ed.ac.uk> - (let* ((window (posn-window (event-start event))) - (coords (posn-x-y (event-start event))) - (x (car coords)) - (y (cdr coords))) - (if (and (> x 0) (> y 0)) - (set-frame-selected-window nil window)) - (mapcar (lambda (file-name) - (x-dnd-handle-one-url window 'private - (concat "file:" file-name))) - (car (cdr (cdr event))))) - (raise-frame))) + ;; Make sure the drop target has positive co-ords + ;; before setting the selected frame - otherwise it + ;; won't work. <skx@tardis.ed.ac.uk> + (let* ((window (posn-window (event-start event))) + (coords (posn-x-y (event-start event))) + (x (car coords)) + (y (cdr coords))) + (if (and (> x 0) (> y 0)) + (set-frame-selected-window nil window)) + (mapcar (lambda (file-name) + (if (listp file-name) + (let ((line (car file-name)) + (start (car (cdr file-name))) + (end (car (cdr (cdr file-name))))) + (if (> line 0) + (goto-line line) + (if (and (> start 0) (> end 0)) + (progn (set-mark start) + (goto-char end))))) + (x-dnd-handle-one-url window 'private + (concat "file:" file-name)))) + (car (cdr (cdr event))))) + (raise-frame)) (global-set-key [drag-n-drop] 'mac-drag-n-drop)
--- a/src/ChangeLog Thu Dec 30 01:49:38 2004 +0000 +++ b/src/ChangeLog Thu Dec 30 02:04:31 2004 +0000 @@ -1,3 +1,9 @@ +2004-12-29 Sanghyuk Suh <han9kin@mac.com> + + * macterm.c (SelectionRange): Add Xcode position apple event struct. + (do_ae_open_documents): Handle Xcode-style file position open + events. + 2004-12-29 Luc Teirlinck <teirllm@auburn.edu> * buffer.c (syms_of_buffer) <vertical-scroll-bar>: Correct typo.
--- a/src/macterm.c Thu Dec 30 01:49:38 2004 +0000 +++ b/src/macterm.c Thu Dec 30 02:04:31 2004 +0000 @@ -7928,6 +7928,17 @@ /* Called when we receive an AppleEvent with an ID of "kAEOpenDocuments". This routine gets the direct parameter, extracts the FSSpecs in it, and puts their names on a list. */ +#pragma options align=mac68k +typedef struct SelectionRange { + short unused1; // 0 (not used) + short lineNum; // line to select (<0 to specify range) + long startRange; // start of selection range (if line < 0) + long endRange; // end of selection range (if line < 0) + long unused2; // 0 (not used) + long theDate; // modification date/time +} SelectionRange; +#pragma options align=reset + static pascal OSErr do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon) { @@ -7936,11 +7947,19 @@ AEKeyword keyword; DescType actual_type; Size actual_size; + SelectionRange position; err = AEGetParamDesc (message, keyDirectObject, typeAEList, &the_desc); if (err != noErr) goto descriptor_error_exit; + err = AEGetParamPtr (message, keyAEPosition, typeChar, &actual_type, &position, sizeof(SelectionRange), &actual_size); + if (err == noErr) + drag_and_drop_file_list = Fcons (list3 (make_number (position.lineNum + 1), + make_number (position.startRange + 1), + make_number (position.endRange + 1)), + drag_and_drop_file_list); + /* Check to see that we got all of the required parameters from the event descriptor. For an 'odoc' event this should just be the file list. */