Subject: bug#7743: closed (Re: bug#7743: unrmail loses extra blank line at end of message)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 23 Nov 2011 07:52:02 +0000

Your bug report

#7743: unrmail loses extra blank line at end of message

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
7743: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7743
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#7743: unrmail loses extra blank line at end of message
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Wed, 23 Nov 2011 02:50:29 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.0.92

Mark Lillibridge wrote:

>>  So I cannot see that blank lines are going missing (unless going from
>>  Babyl to mbox adds one, and going the other way subtracts one?).
>
>     You got it!  Examine the BABYL file and you will see that Rmail 22.3
> has added an extra blank line after each of your messages.  That was a
> recent (pre transformation to 23) RMAIL bug, I believe.  My older email
> does not have these extra blank lines. 

It sort of makes me wonder if it is worth changing this now, because if
most BABYL files started life as mbox files but were converted by Emacs,
then they have an extra blank line.

But anyway, I installed this.

Subject: unrmail loses extra blank line at end of message
From: Mark Lillibridge <[email-masked]>
To: [email-masked]
Date: Mon, 27 Dec 2010 11:54:10 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

    As of at least Emacs 23.1 and still present in version 24, unrmail
throws away the last blank line of a message if present.  The offending
code is in unrmail.el:

unrmail.el:235:
	    ;; Make sure the message ends with two newlines
	    (goto-char (point-max))
	    (unless (looking-back "\n\n")
	      (insert "\n"))

This is wrong!  Mbox format ends every message with a blank line, which
is not part of the message, so this code by failing to add the necessary
terminator blank line to messages that already end with a blank line
effectively removes the last blank line of such messages.

    The fix is easy: just always add the blank line like so:

unrmail.el:235:
	    ;; Add terminator blank line to message
	    (goto-char (point-max))
	    (insert "\n")

- Mark
PS, the patch for this change hopefully is:

ts-rhel5 [106]% diff original-unrmail.el new-unrmail.el
235c235
<           ;; Make sure the message ends with two newlines
---
>           ;; Add terminator blank line to message
237,238c237
<           (unless (looking-back "\n\n")
<             (insert "\n"))
---
>           (insert "\n")