From: yamaoka Date: Thu, 12 Nov 1998 02:46:10 +0000 (+0000) Subject: * lisp/gnus-msg.el (gnus-summary-resend-bounced-mail): Bind X-Git-Tag: pgnus-ichikawa-199811302358~73 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4a779c6ce9c5232393d736e99b3925c32b41c858;p=elisp%2Fgnus.git- * lisp/gnus-msg.el (gnus-summary-resend-bounced-mail): Bind `gnus-message-setup-hook' to minimum setting. * lisp/message.el (message-bounce-setup-for-mime-edit): New function. (message-bounce-setup-function): New user option. Use `message-bounce-setup-for-mime-edit' in default. (message-bounce): Call `message-bounce-setup-function' if it is non-nil. (message-bounce-setup-hook): New user option. (message-send-mail): Delete useless things. --- diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el index 96c6b66..99ef695 100644 --- a/lisp/gnus-msg.el +++ b/lisp/gnus-msg.el @@ -958,14 +958,15 @@ this is a reply." (interactive "P") (gnus-summary-select-article t) (set-buffer gnus-original-article-buffer) - (gnus-setup-message 'compose-bounce - (let* ((references (mail-fetch-field "references")) - (parent (and references (gnus-parent-id references)))) - (message-bounce) - ;; If there are references, we fetch the article we answered to. - (and fetch parent - (gnus-summary-refer-article parent) - (gnus-summary-show-all-headers))))) + (let ((gnus-message-setup-hook '(gnus-maybe-setup-default-charset))) + (gnus-setup-message 'compose-bounce + (let* ((references (mail-fetch-field "references")) + (parent (and references (gnus-parent-id references)))) + (message-bounce) + ;; If there are references, we fetch the article we answered to. + (and fetch parent + (gnus-summary-refer-article parent) + (gnus-summary-show-all-headers)))))) ;;; Gcc handling. diff --git a/lisp/message.el b/lisp/message.el index a246178..a6ee039 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -165,6 +165,11 @@ If this variable is nil, no such courtesy message will be added." :group 'message-interface :type 'regexp) +(defcustom message-bounce-setup-function 'message-bounce-setup-for-mime-edit + "Function to setup a re-sending bounced message." + :group 'message-sending + :type 'function) + ;;;###autoload (defcustom message-from-style 'default "*Specifies how \"From\" headers look. @@ -569,6 +574,12 @@ the signature is inserted." :group 'message-various :type 'hook) +(defcustom message-bounce-setup-hook nil + "Normal hook, run each time a a re-sending bounced message is initialized. +The function `message-bounce' runs this hook." + :group 'message-various + :type 'hook) + (defcustom message-mode-hook nil "Hook run in message mode buffers." :group 'message-various @@ -2277,7 +2288,7 @@ This sub function is for exclusive use of `message-send-mail'." mime-edit-split-ignored-field-regexp) (case-fold-search t) failure) - (while (string-match "Message-Id" mime-edit-split-ignored-field-regexp) + (while (string-match "Message-ID" mime-edit-split-ignored-field-regexp) (setq mime-edit-split-ignored-field-regexp (concat (substring mime-edit-split-ignored-field-regexp 0 (match-beginning 0)) @@ -2352,10 +2363,7 @@ This sub function is for exclusive use of `message-send-mail'." (set-buffer message-edit-buffer) (if failure (progn - (message "Couldn't send message via mail: %s" - (if (eq 'error (car failure)) - (cadr failure) - failure)) + (message "Couldn't send message via mail: %s" failure) nil) (push 'mail message-sent-message-via))))) @@ -2519,7 +2527,7 @@ This sub function is for exclusive use of `message-send-news'." (let ((mime-edit-split-ignored-field-regexp mime-edit-split-ignored-field-regexp) (case-fold-search t)) - (while (string-match "Message-Id" mime-edit-split-ignored-field-regexp) + (while (string-match "Message-ID" mime-edit-split-ignored-field-regexp) (setq mime-edit-split-ignored-field-regexp (concat (substring mime-edit-split-ignored-field-regexp 0 (match-beginning 0)) @@ -2528,7 +2536,7 @@ This sub function is for exclusive use of `message-send-news'." (substring mime-edit-split-ignored-field-regexp (match-end 0))))) (or - (catch 'message-sending-news-done + (catch 'message-sending-news-failure (mime-edit-maybe-split-and-send (function (lambda () @@ -2540,7 +2548,7 @@ This sub function is for exclusive use of `message-send-news'." (delete-region (match-end 0) (std11-field-end)) (insert " " (message-make-message-id)))) (unless (funcall message-send-news-function method) - (throw 'message-sending-news-done t))))) + (throw 'message-sending-news-failure t))))) nil) (not (funcall message-send-news-function method))))) @@ -4357,6 +4365,13 @@ Optional NEWS will use news to forward instead of mail." (kill-buffer (current-buffer))) (message "Resending message to %s...done" address))) +(defun message-bounce-setup-for-mime-edit () + (goto-char (point-min)) + (when (search-forward (concat "\n" mail-header-separator "\n") nil t) + (replace-match "\n\n")) + (set (make-local-variable 'message-setup-hook) nil) + (mime-edit-again)) + ;;;###autoload (defun message-bounce () "Re-mail the current message. @@ -4396,6 +4411,9 @@ you." (message-remove-header message-ignored-bounced-headers t) (goto-char (point-max)) (insert mail-header-separator)) + (when message-bounce-setup-function + (funcall message-bounce-setup-function)) + (run-hooks 'message-bounce-setup-hook) (message-position-point))) ;;;