Subject: Re: bug#7987: 23.2; Refill error in message-mode

From: Jesse Sheidlower <[email-masked]>
Date: Tue, 8 Feb 2011 10:44:19 -0500

On Mon, Feb 07, 2011 at 03:43:54PM -0500, Glenn Morris wrote:
> Jesse Sheidlower wrote:
> 
> > $ emacs -Q
> > M-x message-mode
> > (type or paste the following text, not including dashes):
> >
> > ---
> > I read with great interest your text, the "Declaration of Independence,"
> > and I was particularly taken with the introduction:
> >
> >   When in the Course of human events it becomes necessary for one people
> >   to dissolve the 
> >   political bands which have connected them with another
> >   and to assume among the powers of the earth, the separate 
> >   and equal
> >   station to which the Laws of Nature and of Nature's God entitle them,
> >   a decent respect to the opinions of mankind requires 
> >   that they should
> >   declare the causes which impel them to the separation.
> >
> > I do think this is one of my favorite passages. Thank you.
> > ---
> >
> > Position point anywhere in the indented section, and type M-q.  The text
> > will be refilled such that there's no space before or after the indented
> > paragraph, the first line of the indented paragraph will be indented
> > four spaces, and the second and subsequent lines should be indented
> > eight spaces.
> 
> This is an artificial example because it is not how a mail buffer
> normally looks. The message filling code does different things in the
> header and in the body of an email. Since your example does not contain
> `mail-header-separator', message thinks it is in the header and fills
> accordingly. If you insert `mail-header-separator' at the start of your
> example buffer, message fills the paragraph correctly.
> 
> Do you have an example of an actual mail composition buffer where the
> message filling code does the wrong thing?

Hmm. I guess you're right, although this behavior doesn't seem to be
mentioned in the Manual. I'm using message-mode with Mutt, so there are
no headers in the buffer. 

The EmacsWiki page on MuttInEmacs does give a code sample (apparently
problematic, as there are various kludgy-looking updates) that 'sets
mail-header-separator to "" for M-q and auto-fill to work correctly', so
the fact that it doesn't normally "work correctly" does seem to be known
behavior. But for what it's worth, one of the Emacs maintainers did look
this over and think it was a bug, so I'm not the only one confused.

I'll experiment further and will update if necessary. Is there a
preferred way to tell message-mode to assume that the buffer is a
message body, rather than a header?

Thanks for the reply.

Jesse Sheidlower