> "Perform the most common action for each type of item dropped
> onto Emacs on Mac OS X. Currently, this means:
> * File or directory -- call `find-file'.
> * URL -- call `browse-url-browser-function'.
> * Text -- insert text at point."
I use my MacOSX system pretty much exclusively as an X11 server, so maybe
I don't understand enough of Mac OS X's GUI philosophy, but I believe that
the behavior by default for URL should be the same as for Text, except maybe
when the browse-url function is configured to use one of the Emacs based
webbrowsers (like W3, or emacs-w3m).
The idea is that if I want to open a URL in Safari or Firefox, I'll
drag&drop it there, whereas if I drop it onto Emacs I most likely *don't*
intend it to go to my external browser.
Of course, if I have url-handlers-mode enabled, maybe I intend URL-drops to
call find-file as well ;-)
> (interactive "e")
> ;; Make sure the drop target has positive co-ords before setting the
> ;; selected frame - otherwise it won't work. <[EMAIL PROTECTED]>
> (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))
Under which circumstances can X and/or Y be negative?
> (mapcar
> (lambda (name)
> (case (car name)
Please use dolist instead of mapcar here.
> (text (insert (cdr name)))
> (url (funcall browse-url-browser-function (cdr name)))
Why not (browse-url (cdr name)) ?
> (file
> (setq name (cdr name))
> (if (and (file-exists-p name)
> (not (string-match (image-file-name-regexp) name)))
> (find-file name)
> (insert name)))))
What is the rationale for the (image-file-name-regexp) exception?
> (cadd event)))
> (raise-frame)
> (recenter))
Why are raise-frame and recenter necessary?
> (defun mac-secondary-dnd-function (event)
Please factor out the commonality between the two functions into an
auxiliary function.
> (global-set-key [shift drag-n-drop] 'mac-secondary-dnd-function)
Does this work? Shouldn't it be [(shift drag-n-drop)]?
Stefan
PS: When I ask a question about a piece of code, the answer should typically
be either to change the code, or to add a comment answering
the question.
_______________________________________________
Emacs-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-devel