From 2b6b0ec160d63ff5f677414dd18b025ac49414fa Mon Sep 17 00:00:00 2001 From: Jesper Harder Date: Fri, 6 Feb 2004 19:37:49 +0000 Subject: [PATCH] (mml-mode, mml-x-dnd-attach-file): Attach drop and drag files. --- lisp/ChangeLog | 3 +++ lisp/mml.el | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5fb0823fe..be9fec4da 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2004-02-06 Jesper Harder + * mml.el (mml-mode, mml-x-dnd-attach-file): Attach drop and drag + files. + * message.el (message-generate-headers-first): Don't quote nil and t in docstrings. diff --git a/lisp/mml.el b/lisp/mml.el index 3b155206c..764ebd2c1 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -37,7 +37,8 @@ (autoload 'gnus-make-local-hook "gnus-util") (autoload 'message-fetch-field "message") (autoload 'fill-flowed-encode "flow-fill") - (autoload 'message-posting-charset "message")) + (autoload 'message-posting-charset "message") + (autoload 'x-dnd-get-local-file-name "x-dnd")) (defcustom mml-content-type-parameters '(name access-type expiration size permission format) @@ -888,6 +889,11 @@ See Info node `(emacs-mime)Composing'. (> (prefix-numeric-value arg) 0))) (add-minor-mode 'mml-mode " MML" mml-mode-map) (easy-menu-add mml-menu mml-mode-map) + (when (boundp 'x-dnd-protocol-alist) + (set (make-local-variable 'x-dnd-protocol-alist) + '(("^file:///" . mml-x-dnd-attach-file) + ("^file://" . x-dnd-open-file) + ("^file:" . mml-x-dnd-attach-file)))) (run-hooks 'mml-mode-hook))) ;;; @@ -1005,6 +1011,15 @@ description of the attachment." 'disposition (or disposition "attachment") 'description description)) +(defun mml-x-dnd-attach-file (uri action) + "Attach a drag and drop file." + (let ((file (x-dnd-get-local-file-name uri t))) + (when (and file (file-regular-p file)) + (let* ((type (mml-minibuffer-read-type file)) + (description (mml-minibuffer-read-description)) + (disposition (mml-minibuffer-read-disposition type))) + (mml-attach-file file type description disposition))))) + (defun mml-attach-buffer (buffer &optional type description) "Attach a buffer to the outgoing MIME message. See `mml-attach-file' for details of operation." -- 2.34.1