diff 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
line wrap: on
line diff
--- 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)