2

Since updating to Emacs 26.1. message mode was changed so that M-q does something unexpected. I have fill-column and message-fill-column both set to 72 and pressing M-q on this text:

enter image description here

turns it into this text:

enter image description here

It seems that in other modes M-q does what it usually does. In particular, if I switch this buffer to text mode I can get the expected formatting.

Update: I have researched the issue. It appears as if in message mode the function message-fill-paragraph is called. This function was slightly changed from 25.3 to 26.1. But essentially it just calls message-newline-and-reformat which actually does something else. I can't find the reason for the totally unexpected behaviour of message-fill-paragraph. It does not what it says it should do and for example seems totally unrelated to the value of message-fill-column.

  • 1
    What does C-h k M-q tell you in that context? Then look at the definition of the command that it says is bound to M-q there. – Drew May 30 '18 at 13:44
  • Aha, right. It runs fill-paragraph which runs fill-paragraph-function if that variable is not nil. Indeed, in message mode it is set to message-fill-paragraph from message.el. I'm can't see through that function, though. I can replace it with fill-paragraph, though. – Thomas Kahle May 30 '18 at 17:08
  • You can post the answer you found as an answer (to your own question), showing others what you did to fix the problem. (And you can accept your own answer.) Be aware that comments can be deleted at any time - what helps people is to have a question and an answer (or several answers). – Drew May 30 '18 at 23:50
  • I can't solve it. – Thomas Kahle Jun 1 '18 at 7:58
  • Do you have the mail-header-separator which typically is --text follows this line-- in your message? If not your paragraph possibly gets handled as a field. – Marco Wahl Jun 1 '18 at 12:31
1
+50

With the default settings M-q effectively calls function message-fill-paragraph in message-mode. message-fill-paragraph acts differently for the header part and the rest of the message. The fill adds extra whitespace at the beginning of lines. The separation of the parts is given by the string given by the customizable variable mail-header-separator which has the default value "--text follows this line--".

Example:

Have the following text in a buffer in message mode (and fill-column 72):

I am sorry about your difficulties with git push.  It is true that in this situation
--text follows this line--
I am sorry about your difficulties with git push.  It is true that in this situation

M-q on each line starting with "I am sorry" yields:

I am sorry about your difficulties with git push.  It is true that in this
    situation
--text follows this line--
I am sorry about your difficulties with git push.  It is true that in
this situation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.