* drag-n-drop can't be customized by the target buffer
@ 2004-08-27 17:56 Kevin Rodgers
0 siblings, 0 replies; only message in thread
From: Kevin Rodgers @ 2004-08-27 17:56 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 546 bytes --]
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
[-- Attachment #2: Re: Drag-and-drop to attach file in vm mail composition buffer --]
[-- Type: message/rfc822, Size: 2576 bytes --]
From: kosowsky@consult.pretender (Jeffrey J. Kosowsky)
Subject: Re: Drag-and-drop to attach file in vm mail composition buffer
Date: Thu, 26 Aug 2004 18:03:50 GMT
Message-ID: <m28yc1vks9.fsf@consult.pretender>
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. <skx@tardis.ed.ac.uk>
(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)))
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-08-27 17:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-27 17:56 drag-n-drop can't be customized by the target buffer Kevin Rodgers
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).