[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

address@hidden: drag-n-drop can't be customized by the target buffer]

From: Richard Stallman
Subject: address@hidden: drag-n-drop can't be customized by the target buffer]
Date: Sat, 28 Aug 2004 12:48:17 -0400

Would the people who work on drag-n-drop please think about this idea?

------- Start of forwarded message -------
To: address@hidden
From: Kevin Rodgers <address@hidden>
Newsgroups: gnu.emacs.bug
Date: Fri, 27 Aug 2004 11:56:49 -0600
X-Orig-X-Trace: news.uni-berlin.de
X-Accept-Language: en-us
Subject: drag-n-drop can't be customized by the target buffer
Sender: address@hidden
X-Spam-Status: No, hits=2.4 required=5.0
X-Spam-Level: **
X-Spam-Checker-Version: SpamAssassin 2.55 (

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

(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)

instead of hacking foo-drag-n-drop as below.

- -- 
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

Newsgroups: gnu.emacs.vm,gnu.emacs.vm.info
Subject: Re: Drag-and-drop to attach file in vm mail composition buffer
References: <address@hidden>
From: address@hidden (Jeffrey J. Kosowsky)
Message-ID: <address@hidden>
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
X-Complaints-To: address@hidden
X-Trace: trndny03 1093543430 (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

address@hidden (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

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")
    ;; 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))
; JJK addition start
          (if (string= mode-name "Mail")
                   (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)))))

- --------------040309070504020707020408
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Bug-gnu-emacs mailing list

- --------------040309070504020707020408--
------- End of forwarded message -------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]