emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105694: Fix bug #9392 with rmail-for


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105694: Fix bug #9392 with rmail-forward.
Date: Fri, 09 Sep 2011 11:59:51 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105694 [merge]
fixes bug(s): http://debbugs.gnu.org/9392
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2011-09-09 11:59:51 +0300
message:
  Fix bug #9392 with rmail-forward.
  
   lisp/simple.el (mail-encode-mml): New defvar.
   lisp/mail/rmail.el (mail-encode-mml): Add a defvar.
   (rmail-enable-mime-composing): Default to t.
   (rmail-forward): Use MIME method of forwarding only if both
   rmail-enable-mime-composing and rmail-enable-mime are non-nil.
   Set mail-encode-mml non-nil if the MIME method was used.
   lisp/mail/sendmail.el (mml-to-mime): Add autoload form.
   (mail-encode-mml): Add a defvar.
   (mail-mode): Make mail-encode-mml buffer-local and initialize it
   to nil.
   (mail-send): If mail-encode-mml is non-nil, run the outgoing
   message through mml-to-mime, and reset mail-encode-mml to nil.
modified:
  lisp/ChangeLog
  lisp/mail/rmail.el
  lisp/mail/sendmail.el
  lisp/simple.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-09-09 06:34:59 +0000
+++ b/lisp/ChangeLog    2011-09-09 08:59:51 +0000
@@ -1,3 +1,21 @@
+2011-09-09  Eli Zaretskii  <address@hidden>
+
+       Fix for Savannah bug#9392.
+       * simple.el (mail-encode-mml): New defvar.
+
+       * mail/rmail.el (mail-encode-mml): Add a defvar.
+       (rmail-enable-mime-composing): Default to t.
+       (rmail-forward): Use MIME method of forwarding only if both
+       rmail-enable-mime-composing and rmail-enable-mime are non-nil.
+       Set mail-encode-mml non-nil if the MIME method was used.
+
+       * mail/sendmail.el (mml-to-mime): Add autoload form.
+       (mail-encode-mml): Add a defvar.
+       (mail-mode): Make mail-encode-mml buffer-local and initialize it
+       to nil.
+       (mail-send): If mail-encode-mml is non-nil, run the outgoing
+       message through mml-to-mime, and reset mail-encode-mml to nil.
+
 2011-09-09  Glenn Morris  <address@hidden>
 
        * woman.el (woman-if-body): When processing an .el block,

=== modified file 'lisp/mail/rmail.el'
--- a/lisp/mail/rmail.el        2011-09-03 08:44:16 +0000
+++ b/lisp/mail/rmail.el        2011-09-09 08:59:51 +0000
@@ -91,6 +91,7 @@
 (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 @@
   :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 @@
            ;; 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'
--- a/lisp/mail/sendmail.el     2011-09-03 20:24:12 +0000
+++ b/lisp/mail/sendmail.el     2011-09-09 08:59:51 +0000
@@ -31,6 +31,9 @@
 
 (require 'rfc2047)
 
+(autoload 'mml-to-mime "mml"
+  "Translate the current buffer from MML to MIME.")
+
 (defgroup sendmail nil
   "Mail sending commands for Emacs."
   :prefix "mail-"
@@ -678,6 +681,7 @@
   :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 +705,8 @@
   (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 +940,9 @@
              (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)

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2011-09-07 11:46:56 +0000
+++ b/lisp/simple.el    2011-09-09 08:59:51 +0000
@@ -5729,6 +5729,11 @@
         "^\\([:\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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]