Subject: Re: bug#31651: 26.1.50; message-forward-included-headers should contain "^$"

From: Katsumi Yamaoka <[email-masked]>
Date: Thu, 31 May 2018 08:30:37 +0900

On Wed, 30 May 2018 09:56:11 +0200, Andreas Schwab wrote:
> I think this is a bug.  The empty line is not a header line, so it
> should not be matched against.

Though I was going to apply the following first change, I came
to think you are right and committed the second one.  Thanks.

1. Make `message-remove-ignored-headers' exclude header separator
   when narrowing.

--- message.el~	2018-01-12 03:53:45.394148600 +0000
+++ message.el	2018-05-30 22:49:55.198043700 +0000
@@ -7393,3 +7393,6 @@
       (narrow-to-region (point)
-			(or (search-forward "\n\n" nil t) (point)))
+			(if (search-forward "\n\n" nil t)
+			    ;; Exclude header separator.
+			    (1- (match-end 0))
+			  (point)))
       (when message-forward-ignored-headers

2. Make `message-remove-header' not remove things not looking
   like header ("[!-9;-~]+:" comes from RFC2822 section 2.2).

--- message.el~	2018-01-12 03:53:45.394148600 +0000
+++ message.el	2018-05-30 22:49:55.198043700 +0000
@@ -2433,3 +2433,5 @@
       (if (if reverse
-	      (not (looking-at regexp))
+	      (and (not (looking-at regexp))
+		   ;; Don't remove things not looking like header.
+		   (looking-at "[!-9;-~]+:"))
 	    (looking-at regexp))