From: Eli Zaretskii Date: Sat, 3 Sep 2011 10:00:13 +0000 (+0300) Subject: Fix rmail-forward. X-Git-Tag: emacs-pretest-24.0.90~104^2~124^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fd59d131bb4fe60fe008156795c243ec6e1127b0;p=emacs.git Fix rmail-forward. --- diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 52cef1925a2..70bca776de1 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -6530,7 +6530,8 @@ are not included." (message-position-point) ;; Allow correct handling of `message-checksum' in `message-yank-original': (set-buffer-modified-p nil) - (undo-boundary)) + (undo-boundary) + t) (defun message-set-auto-save-file-name () "Associate the message buffer with a file in the drafts directory." diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 9b4bbf91823..a5a6a4985ef 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -91,6 +91,7 @@ its character representation and its display representation.") (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-mime-feature' is available." :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) @@ -4507,7 +4516,7 @@ With prefix argument N moves forward N messages with these labels. ;;;*** -;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "a7d3e7205efa4e20ca9038c9b260ce83") +;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "2c8675d7c069c68bc36a4003b15448d1") ;;; Generated autoloads from rmailmm.el (autoload 'rmail-mime "rmailmm" "\ diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 597068562b5..d3351255583 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -426,7 +426,7 @@ The value is a vector [ INDEX HEADER TAGLINE BODY END], where "Insert a tag line for MIME-entity ENTITY. ITEM-LIST is a list of strings or button-elements (list) to be added to the tag line." - (insert "[") + (insert "\n[") (let ((tag (aref (rmail-mime-entity-tagline entity) 0))) (if (> (length tag) 0) (insert (substring tag 1) ":"))) (insert (car (rmail-mime-entity-type entity)) " ") @@ -439,7 +439,7 @@ to the tag line." (if (stringp item) (insert item) (apply 'insert-button item)))) - (insert "]\n")) + (insert "]\n\n")) (defun rmail-mime-update-tagline (entity) "Update the current tag line for MIME-entity ENTITY." diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 158435de86b..c460cec77c1 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -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 @@ switching to, the `*mail*' buffer. See also `mail-setup-hook'." :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 @@ Turning on Mail mode runs the normal hooks `text-mode-hook' and (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 @@ 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) diff --git a/lisp/simple.el b/lisp/simple.el index fe46e36fdac..499ffc1acb9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5727,6 +5727,11 @@ else the end of the last line. This function obeys RFC822." "^\\([:\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)