From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/60637 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.gnus.general Subject: mml-attach-file: Argument TYPE is not optional Date: Tue, 26 Jul 2005 16:22:05 +0200 Organization: Dept. of Theoretical Physics, University of Ulm Message-ID: Reply-To: Reiner Steib NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1122389949 12817 80.91.229.6 (26 Jul 2005 14:59:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2005 14:59:09 +0000 (UTC) Original-X-From: ding-owner+M9165@lists.math.uh.edu Tue Jul 26 16:59:02 2005 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1DxQtZ-0003Vu-00 for ; Tue, 26 Jul 2005 16:59:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1DxQYy-0000Mh-00; Tue, 26 Jul 2005 09:37:44 -0500 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1DxQPR-0000JY-01 for ding@lists.math.uh.edu; Tue, 26 Jul 2005 09:27:53 -0500 Original-Received: from quimby.gnus.org ([80.91.224.244]) by util2.math.uh.edu with esmtp (Exim 4.30) id 1DxQLB-0000nZ-I3 for ding@lists.math.uh.edu; Tue, 26 Jul 2005 09:23:29 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1DxQLA-0006ip-00 for ; Tue, 26 Jul 2005 16:23:28 +0200 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DxQKk-0001rQ-TL for ding@gnus.org; Tue, 26 Jul 2005 16:23:02 +0200 Original-Received: from bridgekeeper.physik.uni-ulm.de ([134.60.10.123]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Jul 2005 16:23:02 +0200 Original-Received: from Reiner.Steib by bridgekeeper.physik.uni-ulm.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Jul 2005 16:23:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-To: ding@gnus.org Original-Lines: 97 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: bridgekeeper.physik.uni-ulm.de X-Face: P05mdcZT&lL[-s2=mw~RsllZ0zZAb?vdE}.s , C-c RET f, C-c C-a. | (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 | `C-c C-c' or `C-c C-s'. | | FILE is the name of the file to attach. TYPE is its content-type, a | string of the form "type/subtype". DESCRIPTION is a one-line | description of the attachment. `---- After evaluating (mml-attach-file "/tmp/ste/gnus/test-file-1.txt") in a message buffer, I get: | <# part filename="/tmp/ste/gnus/test-file-1.txt" disposition=attachment> | <# /part> Note: type="text/plain" is not specified. When sending the message, I get the backtrace listed below[1]. I'm not sure about the best way to fix this problem: (1) Make TYPE in `mml-attach-file' mandatory. (2) Set Content-Type in `mml-generate-mime-1' appropriately if no type=".../..." is specified. Patch for solution (2): --8<---------------cut here---------------start------------->8--- --- mml.el 22 Jul 2005 18:49:24 +0200 6.88.2.10 +++ mml.el 26 Jul 2005 15:50:11 +0200 @@ -518,7 +518,11 @@ (mml-insert-parameter-string cont '(expiration size permission)))) (insert "\n\n") - (insert "Content-Type: " (cdr (assq 'type cont)) "\n") + (insert "Content-Type: " + (or (cdr (assq 'type cont)) + (and name (mm-default-file-encoding name)) + "application/octet-stream") + "\n") (insert "Content-ID: " (message-make-message-id) "\n") (insert "Content-Transfer-Encoding: " (or (cdr (assq 'encoding cont)) "binary")) --8<---------------cut here---------------end--------------->8--- Opinions? Unless there are other suggestion, I'll install (2). Bye, Reiner. [1] Backtrace (probably you need to specify a Gcc group and set gnus-gcc-externalize-attachments to 'all to reproduce the problem): --8<---------------cut here---------------start------------->8--- Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil) insert("Content-Type: " nil "\n") (cond ((or ... ...) (let ... ... ...)) ((eq ... ...) (insert "Content-Type: message/external-body") (let ... ... ... ...) (insert "\n\n") (insert "Content-Type: " ... "\n") (insert "Content-ID: " ... "\n") (insert "Content-Transfer-Encoding: " ...) (insert "\n\n") (insert ...) (insert "\n")) ((eq ... ...) (let* ... ...)) (t (error "Invalid element: %S" cont))) (save-restriction (narrow-to-region (point) (point)) (mml-tweak-part cont) (cond (... ...) (... ... ... ... ... ... ... ... ... ...) (... ...) (t ...)) (let (... ... sender recipients) (when ... ... ... ...))) (let ((mm-use-ultra-safe-encoding ...)) (save-restriction (narrow-to-region ... ...) (mml-tweak-part cont) (cond ... ... ... ...) (let ... ...))) mml-generate-mime-1((external (name . "/tmp/ste/gnus/test-file-1.txt") (disposition . "attachment") (tag-location . 639) (contents . ""))) (progn (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part)) (if (and (consp part) (consp ...)) (progn (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part))) (when (and (consp part) (consp ...)) (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part)) (while (setq part (pop cont)) (when (and ... ...) (insert "\n--" mml-boundary "\n") (mml-generate-mime-1 part))) (let ((cont cont) part) (while (setq part ...) (when ... ... ...))) (let ((mml-boundary ...)) (insert (format "Content-Type: multipart/%s; boundary=\"%s\"" type mml-boundary) (if ... ... "\n")) (let (... part) (while ... ...)) (insert "\n--" mml-boundary "--\n")) (if handler (funcall (cdr handler) cont) (let (...) (insert ... ...) (let ... ...) (insert "\n--" mml-boundary "--\n"))) (let* ((type ...) (mml-generate-default-type ...) (handler ...)) (if handler (funcall ... cont) (let ... ... ... ...))) (cond ((or ... ...) (let ... ... ...)) ((eq ... ...) (insert "Content-Type: message/external-body") (let ... ... ... ...) (insert "\n\n") (insert "Content-Type: " ... "\n") (insert "Content-ID: " ... "\n") (insert "Content-Transfer-Encoding: " ...) (insert "\n\n") (insert ...) (insert "\n")) ((eq ... ...) (let* ... ...)) (t (error "Invalid element: %S" cont))) (save-restriction (narrow-to-region (point) (point)) (mml-tweak-part cont) (cond (... ...) (... ... ... ... ... ... ... ... ... ...) (... ...) (t ...)) (let (... ... sender recipients) (when ... ... ... ...))) (let ((mm-use-ultra-safe-encoding ...)) (save-restriction (narrow-to-region ... ...) (mml-tweak-part cont) (cond ... ... ... ...) (let ... ...))) mml-generate-mime-1((multipart (type . "mixed") (part (type . "text/plain") (contents . "(mml-attach-file \"/tmp/ste/gnus/test-file-1.txt\")\n\n| < #part filename=\"/tmp/ste/gnus/test-file-1.txt\" disposition=attachment>\n| < #/part>\n\n")) (external (name . "/tmp/ste/gnus/test-file-1.txt") (disposition . "attachment") (tag-location . 639) (contents . "")))) (if (and (consp ...) (= ... 1)) (mml-generate-mime-1 (car cont)) (mml-generate-mime-1 (nconc ... cont))) (save-current-buffer (set-buffer temp-buffer) (if (and ... ...) (mml-generate-mime-1 ...) (mml-generate-mime-1 ...)) (buffer-string)) (with-current-buffer temp-buffer (if (and ... ...) (mml-generate-mime-1 ...) (mml-generate-mime-1 ...)) (buffer-string)) (unwind-protect (with-current-buffer temp-buffer (if ... ... ...) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))) (let ((temp-buffer ...)) (unwind-protect (with-current-buffer temp-buffer ... ...) (and ... ...))) (with-temp-buffer (if (and ... ...) (mml-generate-mime-1 ...) (mml-generate-mime-1 ...)) (buffer-string)) (if (not cont) nil (with-temp-buffer (if ... ... ...) (buffer-string))) (let ((cont ...) (mml-multipart-number mml-multipart-number)) (if (not cont) nil (with-temp-buffer ... ...))) mml-generate-mime() message-encode-message-body() gnus-inews-do-gcc() run-hooks(message-sent-hook) message-send(nil) message-send-and-exit(nil) call-interactively(message-send-and-exit) --8<---------------cut here---------------end--------------->8---