From 16415486b1b82846d07861ff92e1d690243dea7e Mon Sep 17 00:00:00 2001 From: Reiner Steib Date: Sun, 4 Sep 2005 18:54:00 +0000 Subject: [PATCH] (mml-dnd-protocol-alist, mml-dnd-attach-options): New variables. (mml-dnd-attach-file, mml-mode): Use them. --- lisp/ChangeLog | 4 ++++ lisp/mml.el | 57 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4a37e2b82..ea7725e06 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2005-09-04 Reiner Steib + * mml.el (mml-dnd-protocol-alist, mml-dnd-attach-options): New + variables. + (mml-dnd-attach-file, mml-mode): Use them. + * nnweb.el (nnweb-type-definition, nnweb-google-wash-article): Make fetching article by MID work again for Google Groups. Added FIXME concerning gnus-group-make-web-group. diff --git a/lisp/mml.el b/lisp/mml.el index 66c164339..f6e728be1 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -940,9 +940,7 @@ See Info node `(emacs-mime)Composing'. (easy-menu-add mml-menu mml-mode-map) (when (boundp 'dnd-protocol-alist) (set (make-local-variable 'dnd-protocol-alist) - '(("^file:///" . mml-dnd-attach-file) - ("^file://" . dnd-open-file) - ("^file:" . mml-dnd-attach-file)))) + (append mml-dnd-protocol-alist dnd-protocol-alist))) (run-hooks 'mml-mode-hook))) ;;; @@ -1040,6 +1038,36 @@ See Info node `(emacs-mime)Composing'. ;;; Attachment functions. +(defcustom mml-dnd-protocol-alist + '(("^file:///" . mml-dnd-attach-file) + ("^file://" . dnd-open-file) + ("^file:" . mml-dnd-attach-file)) + "The functions to call when a drop in `mml-mode' is made. +See `dnd-protocol-alist' for more information. When nil, behave +as in other buffers." + :type '(choice (repeat (cons (regexp) (function))) + (const :tag "Behave as in other buffers" nil)) + :version "23.0" ;; No Gnus + :group 'message) + +(defcustom mml-dnd-attach-options nil + "Which options should be queried when attaching a file via drag and drop. + +If it is a list, valid members are `type', `description' and +`disposition'. `disposition' implies `type'. If it is nil, +don't ask for options. If it is t, ask the user whether or not +to specify options." + :type '(choice + (const :tag "Non" nil) + (const :tag "Query" t) + (list :value (type description disposition) + (set :inline t + (const type) + (const description) + (const disposition)))) + :version "23.0" ;; No Gnus + :group 'message) + (defun mml-attach-file (file &optional type description disposition) "Attach a file to the outgoing MIME message. The file is not inserted or encoded until you send the message with @@ -1061,12 +1089,27 @@ description of the attachment." 'description description)) (defun mml-dnd-attach-file (uri action) - "Attach a drag and drop file." + "Attach a drag and drop file. + +Ask for type, description or disposition according to +`mml-dnd-attach-options'." (let ((file (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))) + (let ((mml-dnd-attach-options mml-dnd-attach-options) + type description disposition) + (setq mml-dnd-attach-options + (when (and (eq mml-dnd-attach-options t) + (not + (y-or-n-p + "Use default type, disposition and description? "))) + '(type description disposition))) + (when (or (memq 'type mml-dnd-attach-options) + (memq 'disposition mml-dnd-attach-options)) + (setq type (mml-minibuffer-read-type file))) + (when (memq 'description mml-dnd-attach-options) + (setq description (mml-minibuffer-read-description))) + (when (memq 'disposition mml-dnd-attach-options) + (setq disposition (mml-minibuffer-read-disposition type))) (mml-attach-file file type description disposition))))) (defun mml-attach-buffer (buffer &optional type description) -- 2.25.1