From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: drag-n-drop can't be customized by the target buffer Date: Fri, 27 Aug 2004 11:56:49 -0600 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <412F75E1.8010307@yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040309070504020707020408" X-Trace: sea.gmane.org 1093629466 15390 80.91.224.253 (27 Aug 2004 17:57:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Aug 2004 17:57:46 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 27 19:57:24 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C0kyX-0003QH-00 for ; Fri, 27 Aug 2004 19:57:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C0l3D-0000op-O0 for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Aug 2004 14:02:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C0l3C-0000nj-B9 for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2004 14:02:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C0l3A-0000nW-MC for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2004 14:02:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C0l3A-0000nT-Jp for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2004 14:02:08 -0400 Original-Received: from [130.59.10.2] (helo=chx400.switch.ch) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1C0kxv-00005U-8q for bug-gnu-emacs@gnu.org; Fri, 27 Aug 2004 13:56:43 -0400 Original-Received: from mail.fu-berlin.de ([130.133.1.2]) by chx400.switch.ch with esmtp (Exim 3.20 #1) id 1C0kxs-0006LF-00 for gnu-emacs-bug@moderators.isc.org; Fri, 27 Aug 2004 19:56:40 +0200 Original-Received: by Mail.FU-Berlin.DE (Exim 4.42) from curry.zedat.fu-berlin.de ([160.45.10.36]) for gnu-emacs-bug@moderators.isc.org with esmtp id <1C0kxr-000J08-I1>; Fri, 27 Aug 2004 19:56:39 +0200 Original-Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.uni-berlin.de with bsmtp id ; Fri, 27 Aug 2004 19:56:39 +0200 (MEST) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 104 X-Orig-X-Trace: news.uni-berlin.de Nh+o2aku0MLBGtYAyGjzpwgNH8hH4wBq+aJybFTCUbIftZpW4= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:8826 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:8826 This is a multi-part message in MIME format. --------------040309070504020707020408 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit It would be better if each of the term/foo-win.el files had something like: (defvar drag-n-drop-function 'find-file) (defun foo-drag-n-drop (event) ... (mapc drag-n-drop-function (car (cdr (cdr event)))) ... ) so that vm-mail-mode etc. could say: (set (make-local-variable 'drag-n-drop-function) (lambda (file) (vm-mime-attach-file file (or (vm-mime-default-type-from-filename file) "application/octet-stream")))) instead of hacking foo-drag-n-drop as below. Thanks, -- Kevin Rodgers --------------040309070504020707020408 Content-Type: message/rfc822; name="Re: Drag-and-drop to attach file in vm mail composition buffer" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Re: Drag-and-drop to attach file in vm mail composition buffer" Path: uni-berlin.de!fu-berlin.de!peer01.cox.net!cox.net!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny03.POSTED!9056c659!not-for-mail Newsgroups: gnu.emacs.vm,gnu.emacs.vm.info Subject: Re: Drag-and-drop to attach file in vm mail composition buffer References: From: kosowsky@consult.pretender (Jeffrey J. Kosowsky) Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 26 Aug 2004 18:03:50 GMT NNTP-Posting-Host: 141.154.253.43 X-Complaints-To: abuse@verizon.net X-Trace: trndny03 1093543430 141.154.253.43 (Thu, 26 Aug 2004 14:03:50 EDT) NNTP-Posting-Date: Thu, 26 Aug 2004 14:03:50 EDT Xref: uni-berlin.de gnu.emacs.vm.info:17200 kosowsky@consult.pretender (Jeffrey J. Kosowsky) writes: > Using gnuserv, I can use drag-and-drop to open a file in emacs. > > I would like to modify the behavior when the buffer that is exposed is > a mail composition buffer so that the dragged file is attached to the > mail composition buffer rather than opening the file in a new buffer. > > Notionally, instead of doing something like '(find-file file)', I > would do something like '(vm-mime-attach-file file)'. > > However, despite reading gnuserv.el, I can't figure out how and where > to patch this in. > > Any thoughts on how to do this? > OK, I figured it out. Win32 drag-n-drop doesen't use gnuserv/gnuclientw. The relevant functions are documented in term/w32-win.el. I was able to get the desired affect by making some slight modifications to the function: (defun w32-drag-n-drop (event) "Edit the files listed in the drag-n-drop EVENT. Switch to a buffer editing the last file dropped. JJK: Added logic so that adds mime attachments if dragged over a buffer in \"Mail\" mode" (interactive "e") (save-excursion ;; Make sure the drop target has positive co-ords ;; before setting the selected frame - otherwise it ;; won't work. (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)) ; JJK addition start (if (string= mode-name "Mail") (mapcar (lambda (file) (vm-mime-attach-file file "application/octet-stream")) (car (cdr (cdr event)))) (mapcar 'find-file (car (cdr (cdr event)))))) ; JJK addition end ; (mapcar 'find-file (car (cdr (cdr event))))) (raise-frame))) --------------040309070504020707020408 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bug-gnu-emacs mailing list Bug-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs --------------040309070504020707020408--