unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: julien@danjou.info
Cc: 9392@debbugs.gnu.org
Subject: bug#9392: 24.0.50; rmail-forward produces messages in unsupported format that cannot	be	customized away
Date: Fri, 02 Sep 2011 21:47:33 +0300	[thread overview]
Message-ID: <83fwkeeq7u.fsf@gnu.org> (raw)
In-Reply-To: <83liu6esgh.fsf@gnu.org>

> Date: Fri, 02 Sep 2011 20:59:10 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 9392@debbugs.gnu.org
> 
> Done, thanks.  Now on to the original problem...

Is this the right way of converting MML to MIME when sendmail is used
as the MUA?

=== modified file 'lisp/simple.el'
--- lisp/simple.el	2011-07-28 14:05:07 +0000
+++ lisp/simple.el	2011-09-02 18:15:07 +0000
@@ -5727,6 +5727,11 @@ else the end of the last line.  This fun
 	 "^\\([:\n]\\|[^: \t\n]+[ \t\n]\\)" nil 'move)
     (goto-char (match-beginning 0))))
 
+;; Used by Rmail (e.g., rmail-forward).
+(defvar mail-encode-mml nil
+  "If non-nil, mail-user-agent's `sendfunc' command should mml-encode
+the outgoing message before sending it.")
+
 (defun compose-mail (&optional to subject other-headers continue
 		     switch-function yank-action send-actions
 		     return-action)

=== modified file 'lisp/mail/rmail.el'
--- lisp/mail/rmail.el	2011-08-16 02:29:15 +0000
+++ lisp/mail/rmail.el	2011-09-02 18:41:09 +0000
@@ -91,6 +91,7 @@ its character representation and its dis
 (defvar messages-head)
 (defvar total-messages)
 (defvar tool-bar-map)
+(defvar mail-encode-mml)
 
 (defvar rmail-header-style 'normal
   "The current header display style choice, one of
@@ -642,7 +643,7 @@ unless the feature specified by `rmail-m
   :version "23.3"
   :group 'rmail)
 
-(defvar rmail-enable-mime-composing nil
+(defvar rmail-enable-mime-composing t
   "*If non-nil, RMAIL uses `rmail-insert-mime-forwarded-message-function' to forward.")
 
 ;; FIXME unused.
@@ -3794,9 +3795,17 @@ see the documentation of `rmail-resend'.
 	    ;; Insert after header separator--before signature if any.
 	    (rfc822-goto-eoh)
 	    (forward-line 1)
-	    (if (or rmail-enable-mime rmail-enable-mime-composing)
-		(funcall rmail-insert-mime-forwarded-message-function
-			 forward-buffer)
+	    (if (and rmail-enable-mime rmail-enable-mime-composing)
+		(prog1
+		    (funcall rmail-insert-mime-forwarded-message-function
+			     forward-buffer)
+		  ;; rmail-insert-mime-forwarded-message-function
+		  ;; works by inserting MML tags into forward-buffer.
+		  ;; The MUA will need to convert it to MIME before
+		  ;; sending.  mail-encode-mml tells them to do that.
+		  ;; message.el does that automagically.
+		  (or (eq mail-user-agent 'message-user-agent)
+		      (setq mail-encode-mml t)))
 	      (insert "------- Start of forwarded message -------\n")
 	      ;; Quote lines with `- ' if they start with `-'.
 	      (let ((beg (point)) end)

=== modified file 'lisp/mail/sendmail.el'
--- lisp/mail/sendmail.el	2011-08-04 00:58:07 +0000
+++ lisp/mail/sendmail.el	2011-09-02 18:46:19 +0000
@@ -31,6 +31,8 @@
 
 (require 'rfc2047)
 
+(require 'mml)
+
 (defgroup sendmail nil
   "Mail sending commands for Emacs."
   :prefix "mail-"
@@ -678,6 +680,7 @@ switching to, the `*mail*' buffer.  See 
   :options '(footnote-mode))
 
 (defvar mail-mode-abbrev-table text-mode-abbrev-table)
+(defvar mail-encode-mml)
 ;;;###autoload
 (define-derived-mode mail-mode text-mode "Mail"
   "Major mode for editing mail to be sent.
@@ -701,6 +704,8 @@ Turning on Mail mode runs the normal hoo
   (make-local-variable 'mail-reply-action)
   (make-local-variable 'mail-send-actions)
   (make-local-variable 'mail-return-action)
+  (make-local-variable 'mail-encode-mml)
+  (setq mail-encode-mml nil)
   (setq buffer-offer-save t)
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(mail-font-lock-keywords t t))
@@ -934,6 +939,9 @@ the user from the mailer."
 	      (error "Invalid header line (maybe a continuation line lacks initial whitespace)"))
 	    (forward-line 1)))
 	(goto-char opoint)
+	(when mail-encode-mml
+	  (mml-to-mime)
+	  (setq mail-encode-mml nil))
 	(run-hooks 'mail-send-hook)
 	(message "Sending...")
 	(funcall send-mail-function)






  reply	other threads:[~2011-09-02 18:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-28  9:21 bug#9392: 24.0.50; rmail-forward produces messages in unsupported format that cannot be customized away Eli Zaretskii
2011-08-28 21:04 ` Andreas Schwab
2011-08-29  2:55   ` Eli Zaretskii
2011-08-29  5:17     ` Eli Zaretskii
2011-08-30  0:36       ` Kenichi Handa
2011-08-30  2:57         ` Eli Zaretskii
2011-08-30  5:47         ` Eli Zaretskii
2011-09-02 10:46           ` Eli Zaretskii
2011-09-02 10:54             ` Julien Danjou
2011-09-02 14:23               ` Eli Zaretskii
2011-09-02 14:27                 ` Julien Danjou
2011-09-02 17:59                   ` Eli Zaretskii
2011-09-02 18:47                     ` Eli Zaretskii [this message]
2011-09-02 19:13                       ` Julien Danjou
2011-09-02 19:26                         ` Eli Zaretskii
2011-09-03 21:49                       ` Lars Magne Ingebrigtsen
2011-09-09  9:05                         ` Eli Zaretskii
2011-09-16  3:41                           ` Kenichi Handa
2011-09-16  6:57                             ` Eli Zaretskii
2011-09-16  8:02                               ` Kenichi Handa
2011-09-03  0:24 ` Glenn Morris
2011-09-03  7:36   ` Eli Zaretskii
2011-09-06  6:53 ` Reiner Steib

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fwkeeq7u.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=9392@debbugs.gnu.org \
    --cc=julien@danjou.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).