unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7743: unrmail loses extra blank line at end of message
@ 2010-12-27 19:54 Mark Lillibridge
  2011-11-13 19:59 ` bug#7743: bug #7743: unrmail loses extra blank line at end of message [PATCH] Mark Lillibridge
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mark Lillibridge @ 2010-12-27 19:54 UTC (permalink / raw)
  To: 7743


    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")





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#7743: bug #7743: unrmail loses extra blank line at end of message [PATCH]
  2010-12-27 19:54 bug#7743: unrmail loses extra blank line at end of message Mark Lillibridge
@ 2011-11-13 19:59 ` Mark Lillibridge
  2011-11-16  7:52 ` bug#7743: unrmail loses extra blank line at end of message Glenn Morris
       [not found] ` <handler.7743.D7743.132203471715779.notifdone@debbugs.gnu.org>
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Lillibridge @ 2011-11-13 19:59 UTC (permalink / raw)
  To: 7743


    The automatic system seems not to have noticed, but I provided a
patch for this bug:

ts-rhel5 [124]% ( setenv LC_ALL C ; setenv TZ UTC0 ; diff -Naur original-unrmail.el unrmail.el)
--- original-unrmail.el 2011-11-13 19:57:25.156549000 +0000
+++ unrmail.el  2011-11-13 19:58:34.826505000 +0000
@@ -232,10 +232,9 @@
              (while (search-forward "\nFrom " nil t)
                (forward-char -5)
                (insert ?>)))
-           ;; Make sure the message ends with two newlines
+           ;; Add terminator blank line to message
            (goto-char (point-max))
-           (unless (looking-back "\n\n")
-             (insert "\n"))
+           (insert "\n")
            ;; Write it to the output file, suitably encoded.
            (let ((coding-system-for-write coding))
              (write-region (point-min) (point-max) to-file t





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#7743: unrmail loses extra blank line at end of message
  2010-12-27 19:54 bug#7743: unrmail loses extra blank line at end of message Mark Lillibridge
  2011-11-13 19:59 ` bug#7743: bug #7743: unrmail loses extra blank line at end of message [PATCH] Mark Lillibridge
@ 2011-11-16  7:52 ` Glenn Morris
  2011-11-19 20:28   ` Mark Lillibridge
       [not found] ` <handler.7743.D7743.132203471715779.notifdone@debbugs.gnu.org>
  2 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2011-11-16  7:52 UTC (permalink / raw)
  To: mark.lillibridge; +Cc: 7743

Mark Lillibridge wrote:

>     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.

This sounds very believable, but I am having a hard time convinving
myself.

I used the system `mail' command to send myself a few mails ending in
blank lines. I used Emacs 22.3 to convert the resulting mail spool file
to Babyl, then the current trunk's unrmail to convert that Babyl back to
mbox. The mbox I got back was identical to the original mail spool
(modulo the addition of X-RMAIL-ATTRIBUTES and X-Coding-System) headers.

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?).





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#7743: unrmail loses extra blank line at end of message
  2011-11-16  7:52 ` bug#7743: unrmail loses extra blank line at end of message Glenn Morris
@ 2011-11-19 20:28   ` Mark Lillibridge
  2011-11-23  7:50     ` Glenn Morris
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Lillibridge @ 2011-11-19 20:28 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 7743


Glenn wrote:
>  Mark Lillibridge wrote:
>  
>  >     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.
>  
>  This sounds very believable, but I am having a hard time convinving
>  myself.
>  
>  I used the system `mail' command to send myself a few mails ending in
>  blank lines. I used Emacs 22.3 to convert the resulting mail spool file
>  to Babyl, then the current trunk's unrmail to convert that Babyl back to
>  mbox. The mbox I got back was identical to the original mail spool
>  (modulo the addition of X-RMAIL-ATTRIBUTES and X-Coding-System) headers.
>  
>  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.  I haven't reported all the Rmail
22 bugs I've found because they are moot at this point.

- Mark
PS, I will send you (Glenn) my relevant test files in case you didn't
keep yours.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#7743: unrmail loses extra blank line at end of message
  2011-11-19 20:28   ` Mark Lillibridge
@ 2011-11-23  7:50     ` Glenn Morris
  0 siblings, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2011-11-23  7:50 UTC (permalink / raw)
  To: 7743-done

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#7743: closed (Re: bug#7743: unrmail loses extra blank line at end of message)
       [not found] ` <handler.7743.D7743.132203471715779.notifdone@debbugs.gnu.org>
@ 2011-11-26  6:06   ` Mark Lillibridge
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Lillibridge @ 2011-11-26  6:06 UTC (permalink / raw)
  To: 7743


Glenn Morris writes:
>  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.

        The adding an extra line on incorporation is a recent bug; my
older BABYL files don't have the extra blank lines.

- Mark





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-26  6:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-27 19:54 bug#7743: unrmail loses extra blank line at end of message Mark Lillibridge
2011-11-13 19:59 ` bug#7743: bug #7743: unrmail loses extra blank line at end of message [PATCH] Mark Lillibridge
2011-11-16  7:52 ` bug#7743: unrmail loses extra blank line at end of message Glenn Morris
2011-11-19 20:28   ` Mark Lillibridge
2011-11-23  7:50     ` Glenn Morris
     [not found] ` <handler.7743.D7743.132203471715779.notifdone@debbugs.gnu.org>
2011-11-26  6:06   ` bug#7743: closed (Re: bug#7743: unrmail loses extra blank line at end of message) Mark Lillibridge

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).