From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/77106 Path: news.gmane.org!not-for-mail From: Hobbit Newsgroups: gmane.emacs.gnus.general Subject: Re: Attach file improvement Date: Tue, 22 Feb 2011 14:49:49 +0200 Message-ID: <8762scb5ea.fsf@myhost.localdomain> References: <87d3mkb7bu.fsf@myhost.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1298378816 1423 80.91.229.12 (22 Feb 2011 12:46:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 22 Feb 2011 12:46:56 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M25439@lists.math.uh.edu Tue Feb 22 13:46:52 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Prrdj-0005Xf-UV for ding-account@gmane.org; Tue, 22 Feb 2011 13:46:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PrrdV-0002PY-3j; Tue, 22 Feb 2011 06:46:37 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PrrdT-0002PB-6L for ding@lists.math.uh.edu; Tue, 22 Feb 2011 06:46:35 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PrrdR-0003qr-7s for ding@lists.math.uh.edu; Tue, 22 Feb 2011 06:46:34 -0600 Original-Received: from forward10.mail.yandex.net ([77.88.61.49]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1PrrdP-0005kN-U1 for ding@gnus.org; Tue, 22 Feb 2011 13:46:32 +0100 Original-Received: from smtp6.mail.yandex.net (smtp6.mail.yandex.net [77.88.61.56]) by forward10.mail.yandex.net (Yandex) with ESMTP id 5186E1021DCE for ; Tue, 22 Feb 2011 15:46:24 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1298378784; bh=LXr0WysaIaIPTxPsrE/y1zsT61i1xhgKpBlitIdHInU=; h=From:To:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=wi0e/f3RifRuLrMZgfY0OQwfpfgJmZx+NBHvDSJxcWIxEdHKCP7lo6mI3YgcewOW7 pv0NDaW24pjTezj+LXFDwmfMyP8BPlrvHL9EY8un7LHnOmNIH3xRFAslOFMWr/KIvx R2iHSvt6mrzkrGCFc1GgwnK9Za8ygx0Eq6kAE3Xs= Original-Received: from myhost.localdomain (118-207-133-95.pool.ukrtel.net [95.133.207.118]) by smtp6.mail.yandex.net (Yandex) with ESMTPSA id F1B572A808C for ; Tue, 22 Feb 2011 15:46:23 +0300 (MSK) In-Reply-To: <87d3mkb7bu.fsf@myhost.localdomain> (Hobbit's message of "Tue, 22 Feb 2011 14:08:05 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin (3.3.1 2010-03-16) analysis follows Bayesian score: 0.0006 Ham tokens: 0.000-1720--4265h-0s--0d--H*u:Emacs, 0.000-1652--4096h-0s--0d--H*u:Gnus, 0.000-1596--3956h-0s--0d--H*u:linux, 0.000-1596--3956h-0s--0d--H*UA:linux, 0.000-1539--3815h-0s--0d--H*UA:gnu Spam tokens: 0.999-2--0h-16s--0d--redefines, 0.998-22023--199h-270447s--0d--UD:ru, 0.993-1--0h-2s--1d--hobbit, 0.993-1--0h-2s--1d--D*yandex.ru, 0.987-1--0h-1s--0d--yandexru Autolearn status: no 0.0 FREEMAIL_FROM Sender email is freemail (werehobbit[at]yandex.ru) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [77.88.61.49 listed in list.dnswl.org] 2.3 FSL_RU_URL URI: FSL_RU_URL -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0006] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:77106 Archived-At: Hobbit writes: > Could you merge it into a Gnus repository? > > Patch for lisp/mml.el: Sorry for inconvenience. Patch in recommended style: diff --git a/lisp/mml.el b/lisp/mml.el index 8b196fa..5403aab 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -1205,6 +1205,15 @@ If not set, `default-directory' will be used." string default))) +(defun mml-minibuffer-read-charset (&optional default) + (let ((charset (completing-read + (format "Charset (default %s): " default) + (mapcar 'symbol-name charset-list) + nil t nil nil default))) + (if (not (equal charset "")) + charset + default))) + (defun mml-minibuffer-read-description () (let ((description (read-string "One line description: "))) (when (string-match "\\`[ \t]*\\'" description) @@ -1294,7 +1303,8 @@ to specify options." :version "22.1" ;; Gnus 5.10.9 :group 'message) -(defun mml-attach-file (file &optional type description disposition) +(defun mml-attach-file (file &optional type description + disposition charset) "Attach a file to the outgoing MIME message. The file is not inserted or encoded until you send the message with `\\[message-send-and-exit]' or `\\[message-send]'. @@ -1304,13 +1314,17 @@ content-type, a string of the form \"type/subtype\". DESCRIPTION is a one-line description of the attachment. The DISPOSITION specifies how the attachment is intended to be displayed. It can be either \"inline\" (displayed automatically within the message -body) or \"attachment\" (separate from the body)." +body) or \"attachment\" (separate from the body). CHARSET is file +charset." (interactive (let* ((file (mml-minibuffer-read-file "Attach file: ")) (type (mml-minibuffer-read-type file)) + (charset (when (member (car (split-string type "/")) + '("text" "message")) + (mml-minibuffer-read-charset))) (description (mml-minibuffer-read-description)) (disposition (mml-minibuffer-read-disposition type nil file))) - (list file type description disposition))) + (list file type description disposition charset))) ;; Don't move point if this command is invoked inside the message header. (let ((head (unless (message-in-body-p) (prog1 @@ -1318,6 +1332,7 @@ body) or \"attachment\" (separate from the body)." (goto-char (point-max)))))) (mml-insert-empty-tag 'part 'type type + 'charset charset ;; icicles redefines read-file-name and returns a ;; string w/ text properties :-/ 'filename (mm-substring-no-properties file)