[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] enhanced mac drag-n-drop
From: |
Stefan Monnier |
Subject: |
Re: [patch] enhanced mac drag-n-drop |
Date: |
Wed, 06 Apr 2005 07:37:24 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> "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. <address@hidden>
> (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.
- [patch] enhanced mac drag-n-drop, Sean O'Rourke, 2005/04/05
- Re: [patch] enhanced mac drag-n-drop,
Stefan Monnier <=
- Re: [patch] enhanced mac drag-n-drop, Jan D., 2005/04/06
- Re: [patch] enhanced mac drag-n-drop, Sean O'Rourke, 2005/04/06
- Re: [patch] enhanced mac drag-n-drop, Jan D., 2005/04/06
- Message not available
- Re: [patch] enhanced mac drag-n-drop, Jan D., 2005/04/07
- Re: [patch] enhanced mac drag-n-drop, Jason Rumney, 2005/04/07
- Re: [patch] enhanced mac drag-n-drop, Sean O'Rourke, 2005/04/07
- Re: [patch] enhanced mac drag-n-drop, Jan D., 2005/04/07
- Re: [patch] enhanced mac drag-n-drop, Jan D., 2005/04/11
Re: [patch] enhanced mac drag-n-drop, YAMAMOTO Mitsuharu, 2005/04/09