From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: Patch for remote files in dnd.el Date: Wed, 06 Sep 2006 13:15:06 +0200 Message-ID: <44FEADBA.6080401@swipnet.se> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1157541386 5380 80.91.229.2 (6 Sep 2006 11:16:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 6 Sep 2006 11:16:26 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 06 13:16:23 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GKvOA-0006YR-3u for ged-emacs-devel@m.gmane.org; Wed, 06 Sep 2006 13:16:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GKvO8-0001wJ-LI for ged-emacs-devel@m.gmane.org; Wed, 06 Sep 2006 07:16:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GKvNr-0001un-T8 for emacs-devel@gnu.org; Wed, 06 Sep 2006 07:15:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GKvNr-0001u9-8x for emacs-devel@gnu.org; Wed, 06 Sep 2006 07:15:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GKvNr-0001u6-3g for emacs-devel@gnu.org; Wed, 06 Sep 2006 07:15:55 -0400 Original-Received: from [81.228.8.184] (helo=av11-2-sn2.hy.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GKvNx-0006sm-R4; Wed, 06 Sep 2006 07:16:02 -0400 Original-Received: by av11-2-sn2.hy.skanova.net (Postfix, from userid 502) id 8E71C38523; Wed, 6 Sep 2006 13:15:52 +0200 (CEST) Original-Received: from smtp4-1-sn2.hy.skanova.net (smtp4-1-sn2.hy.skanova.net [81.228.8.92]) by av11-2-sn2.hy.skanova.net (Postfix) with ESMTP id 802B038050; Wed, 6 Sep 2006 13:15:52 +0200 (CEST) Original-Received: from coolsville.localdomain (81-235-205-78-no59.tbcn.telia.com [81.235.205.78]) by smtp4-1-sn2.hy.skanova.net (Postfix) with ESMTP id 62DB337E55; Wed, 6 Sep 2006 13:15:52 +0200 (CEST) User-Agent: Thunderbird 1.5.0.5 (X11/20060808) Original-To: Jason Rumney In-Reply-To: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." 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:59437 Archived-At: I think we should install this. On GNU/Linux neither Nautilus or Konqueror (file browsers for Gnome and KDE) puts the host name in files dropped. So there is basically no way a user can drop remote files onto Emacs in GNU/Linux. On W32 this restors the old behaviour of Emacs 21 AFAIK, so it is not a new feature. Jan D. Richard Stallman wrote: > I don't want to add features that work only on proprietary systems. > Our goal is to replace those systems, not to enhance them. > This is a fine feature, but it needs to work on GNU/Linux before > we support it. > > (Also, this feature is not urgent, and this is not the time for > new features.) Jason Rumney wrote: > The following patch to dnd.el adds support for remote files via a new > variable dnd-open-remote-file-function. > > On Windows, this defaults to the new function dnd-open-unc-file, on > other platforms it is nil, giving the old behavior. If other platforms > can receive remote files by drag and drop, then appropriate methods > for accessing them can be added (perhaps via tramp). > > > Any objections to installing this now? > > > *** dnd.el 05 Jun 2006 22:10:29 +0100 1.9 > --- dnd.el 27 Jul 2006 23:14:05 +0100 > *************** > *** 59,64 **** > --- 59,78 ---- > :group 'dnd) > > > + (defcustom dnd-open-remote-file-function > + (if (eq system-type 'windows-nt) > + 'dnd-open-unc-file > + nil) > + "The function to call when opening a file on a remote machine. > + The function will be called with two arguments; URI and ACTION. See > + `dnd-open-file' for details. > + If nil, then dragging remote files into Emacs will result in an error. > + Predefined functions are `dnd-open-unc-file', which attempts to open > + the file using its UNC name and is the default on MS-Windows." > + :version "22.1" > + :type 'function > + :group 'dnd) > + > > (defcustom dnd-open-file-other-window nil > "If non-nil, always use find-file-other-window to open dropped files." > *************** > *** 158,163 **** > --- 172,195 ---- > 'private) > (error "Can not read %s" uri)))) > > + > + (defun dnd-open-unc-file (uri action) > + "Open a remote file using its unc path. > + The file is opened in the current window, or a new window if > + `dnd-open-file-other-window' is set. URI is the url for the file, > + and must have the format file://hostname/file-name. ACTION is ignored. > + //hostname/file-name is the unc path." > + (let ((unc-file (if (string-match "^file:" uri) > + (substring uri 5)))) > + (if (and unc-file (file-readable-p unc-file)) > + (progn > + (if dnd-open-file-other-window > + (find-file-other-window unc-file) > + (find-file unc-file)) > + 'private) > + (error "Invalid file url")))) > + > + > (defun dnd-open-file (uri action) > "Open a local or remote file. > The file is opened in the current window, or a new window if > *************** > *** 169,175 **** > ;; file. Otherwise return nil. > (let ((local-file (dnd-get-local-file-uri uri))) > (if local-file (dnd-open-local-file local-file action) > ! (error "Remote files not supported")))) > > > (defun dnd-insert-text (window action text) > --- 201,209 ---- > ;; file. Otherwise return nil. > (let ((local-file (dnd-get-local-file-uri uri))) > (if local-file (dnd-open-local-file local-file action) > ! (if dnd-open-remote-file-function > ! (funcall dnd-open-remote-file-function uri action) > ! (error "Remote files not supported"))))) > > > (defun dnd-insert-text (window action text) > > > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel