changeset 13572:abbd898a545b

(rmail-retry-failure): Add missing colons in regexp. Use " +", not " *", to check for indented text. Don't make a temp buffer; just record the indent amount. Simplify.
author Karl Heuer <kwzh@gnu.org>
date Fri, 17 Nov 1995 08:23:27 +0000
parents 1c20ebe08f0a
children 6fff4a5fc018
files lisp/mail/rmail.el
diffstat 1 files changed, 23 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Thu Nov 16 22:04:24 1995 +0000
+++ b/lisp/mail/rmail.el	Fri Nov 17 08:23:27 1995 +0000
@@ -2362,7 +2362,7 @@
 specifying headers which should not be copied into the new message."
   (interactive)
   (require 'mail-utils)
-  (let (mail-buffer bounce-start bounce-end resending)
+  (let (mail-buffer bounce-start bounce-end bounce-indent resending)
     (save-excursion
       ;; Narrow down to just the quoted original message
       (rmail-beginning-of-message)
@@ -2389,36 +2389,26 @@
 	  ;; Support a style of failure message in which the original
 	  ;; message is indented, and included within lines saying
 	  ;; `Start of returned message' and `End of returned message'.
-	  (if (looking-at " *Received:")
-	      (let (column)
+	  (if (looking-at " +Received:")
+	      (progn
+		(setq bounce-start (point))
 		(skip-chars-forward " ")
-		(setq column (current-column))
-		(let ((old-buffer (current-buffer)))
-		  (set-buffer (get-buffer-create " rmail retry temp"))
-		  (insert-buffer old-buffer)
-		  (goto-char (point-max))
-		  (if (re-search-backward "^End of returned message$" nil t)
-		      (delete-region (point) (point-max)))
-		  (indent-rigidly (point-min) (point-max) (- column))
-		  (goto-char (point-min))
-		  (re-search-forward mail-unsent-separator nil t))))
-	  (save-restriction
-	    (let ((old-end (point-max)))
-	      ;; One message contained a few random lines before the old
-	      ;; message header.  The first line of the message started with
-	      ;; two hyphens.  A blank line follows these random lines.
-	      (skip-chars-forward "\n")
-	      (if (looking-at "^--")
-		  (progn
-		    (search-forward "\n\n")
-		    (skip-chars-forward "\n")))
-	      (beginning-of-line)
-	      (narrow-to-region (point) (point-max))
-	      (setq mail-buffer (current-buffer)
-		    bounce-start (point)
-		    bounce-end (point-max))
-	      (or (search-forward "\n\n" nil t)
-		  (error "Cannot find end of header in failed message")))))))
+		(setq bounce-indent (- (current-column)))
+		(goto-char (point-max))
+		(re-search-backward "^End of returned message$" nil t)
+		(setq bounce-end (point)))
+	    ;; One message contained a few random lines before the old
+	    ;; message header.  The first line of the message started with
+	    ;; two hyphens.  A blank line follows these random lines.
+	    (if (looking-at "^--")
+		(progn
+		  (search-forward "\n\n")
+		  (skip-chars-forward "\n")))
+	    (setq bounce-start (point)
+		  bounce-end (point-max))
+	    (or (search-forward "\n\n" nil t)
+		(error "Cannot find end of header in failed message")))
+	  (setq mail-buffer (current-buffer)))))
     ;; Start sending a new message; default header fields from the original.
     ;; Turn off the usual actions for initializing the message body
     ;; because we want to get only the text from the failure message.
@@ -2429,8 +2419,10 @@
 	    (erase-buffer)
 	    (insert-buffer-substring mail-buffer bounce-start bounce-end)
 	    (goto-char (point-min))
+	    (if bounce-indent
+		(indent-rigidly (point-min) (point-max) bounce-indent))
 	    (rmail-clear-headers rmail-retry-ignored-headers)
-	    (rmail-clear-headers "^sender:\\|^from\\|^return-path")
+	    (rmail-clear-headers "^sender:\\|^from:\\|^return-path:")
 	    (goto-char (point-min))
 	    (save-restriction
 	      (search-forward "\n\n")