From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.devel Subject: Fwd: Preventing drag & drop the dired way Date: Tue, 10 May 2005 11:43:44 +0200 Message-ID: Reply-To: Reiner Steib NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1115719159 2948 80.91.229.2 (10 May 2005 09:59:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 May 2005 09:59:19 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 10 11:59:17 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DVRVd-0003U0-6r for ged-emacs-devel@m.gmane.org; Tue, 10 May 2005 11:58:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVRe8-0007BC-7r for ged-emacs-devel@m.gmane.org; Tue, 10 May 2005 06:07:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DVRKA-0007NI-6b for emacs-devel@gnu.org; Tue, 10 May 2005 05:46:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DVRK5-0007Hh-Cf for emacs-devel@gnu.org; Tue, 10 May 2005 05:46:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVRK5-0007FG-0W for emacs-devel@gnu.org; Tue, 10 May 2005 05:46:41 -0400 Original-Received: from [134.60.1.1] (helo=mail.uni-ulm.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1DVRNQ-0000A3-3C for emacs-devel@gnu.org; Tue, 10 May 2005 05:50:08 -0400 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.123]) by mail.uni-ulm.de (8.13.3/8.13.3) with ESMTP id j4A9hgQV023106 for ; Tue, 10 May 2005 11:43:43 +0200 (MEST) Original-Received: by bridgekeeper.physik.uni-ulm.de (Postfix, from userid 170) id 84B2B102C8; Tue, 10 May 2005 11:43:44 +0200 (CEST) Mail-Followup-To: Emacs development Original-To: Emacs development X-Face: mtjf/D:es1T0wHO:&CJ'ZXe"l; 3C--rw\z!{`eFwL){|]RpI+4{u25L=5C /0>KuGeTsk<~<&NE-AKV1560e!+RJeyWmSskkrJm?[vUV#66{T_m|Ae<||Ku#Mk5`y&O`n~z2; n8eP J5#2h@2eQgV@E70IY_0WlEx!"&giy{+\%h1LJox$zv@/l%ZmU4^tZA>xQpnkUBVC5.jpg#0'(+2?Rs )NAr:>3<=WxHE$ktbLysDIM5TbmHu*3 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36938 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36938 --=-=-= Content-Type: message/rfc822 Content-Disposition: inline From: "oliver" Newsgroups: comp.emacs Subject: Preventing drag & drop the dired way Date: Tue, 10 May 2005 17:26:49 +1000 Organization: Internet Customer Message-ID: MIME-Version: 1.0 Hi there, normally, if I drag a file onto an Emacs session Emacs opens the file. But sometimes, such as when the window with focus happens to contain a dired buffer something else happens. dired will attempt to copy the file to it's current directory. C-h k always reports w32-drag-n-drop which says nothing about moving or copying a file. Is there an easy way to cause Emacs to always open the file I drag onto it no matter what buffer happens to be displayed? thanks, olli --=-=-= Hi, I would have suggested to use `dired-mode-hook' to reset the dnd variables to their standard values. But this won't work because the DND setup is done after running the hooks in `dired-mode'. I think it is reasonable that a user prefers to have the default drop behavior in dired. Shouldn't we have an option for this? I'd suggest the following patch. Okay to install? 2005-05-10 Reiner Steib * dired.el (dired-dnd-protocol-alist): New variable. (dired-mode): Use `dired-dnd-protocol-alist'. --8<---------------cut here---------------start------------->8--- --- dired.el 12 Apr 2005 11:50:24 +0200 1.307 +++ dired.el 10 May 2005 11:36:53 +0200 @@ -200,6 +200,18 @@ ;; Note this can't simply be run inside function `dired-ls' as the hook ;; functions probably depend on the dired-subdir-alist to be OK. +(defcustom dired-dnd-protocol-alist + '(("^file:///" . dired-dnd-handle-local-file) + ("^file://" . dired-dnd-handle-file) + ("^file:" . dired-dnd-handle-local-file)) + "The functions to call when a drop in `dired-mode' is made. +See `dnd-protocol-alist' for more information. When nil, behave +as in other buffers." + :type '(choice (repeat (cons (regexp) (function))) + (const :tag "Behave as in other buffers" nil)) + :version "22.1" + :group 'dired) + ;; Internal variables (defvar dired-marker-char ?* ; the answer is 42 @@ -1522,14 +1534,11 @@ 'dired-desktop-buffer-misc-data) (setq dired-switches-alist nil) (dired-sort-other dired-actual-switches t) - (run-mode-hooks 'dired-mode-hook) (when (featurep 'dnd) (make-variable-buffer-local 'dnd-protocol-alist) (setq dnd-protocol-alist - (append '(("^file:///" . dired-dnd-handle-local-file) - ("^file://" . dired-dnd-handle-file) - ("^file:" . dired-dnd-handle-local-file)) - dnd-protocol-alist)))) + (append dired-dnd-protocol-alist dnd-protocol-alist))) + (run-mode-hooks 'dired-mode-hook)) ;; Idiosyncratic dired commands that don't deal with marks. --8<---------------cut here---------------end--------------->8--- --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--