Gnus supports format=flowed when both sending and receiving messages, but it doesn’t actually flow the text to windows boundaries like other mail clients do. Doing so requires heavy tinkering, as discussed below.
format=flowed is defined in RFC3676 and enables mail clients to support the distinction between physical and logical lines, while still supporting older clients.
The message is sent wrapped (usually to the 66th column), with newlines encoded with an extra space at the end of the previous line. Graphical clients can unwrap the message back to its original form, performing word-wrapping at window’s margins. Older clients can simply disregard newline information, and display the wrapped message.
The advantage of flowed text (if an entire conversation is handled with
format=flowed) is the improved handling of quoted text, since each quote block is usually a single logical line that gets re-wrapped by the client dynamically. Or that’s the theory, at least.
format=flowed is enabled by default in Gnus, in the sense that encoded messages are correctly decoded and rewrapped according to
‘fill-flowed-display-column’ (which is usually
‘fill-column’), but that’s about it.
The easiest way to deal with
format=flowed is to avoid it: if you want dynamic reflowing, simply unfold encoded lines to full length and setup article buffers to wrap:
(setq fill-flowed-display-column nil) (add-hook 'gnus-article-mode-hook (lambda () (setq truncate-lines nil word-wrap t)))
This will make Gnus behave as most other mail clients.
Composing or replying an article with long lines will choose a more resilient encoding such as
‘quoted-printable’ by default.
‘message-mode’ (as documented) is not enough to compose a flowed message and will most likely (as of 01/2011) kill all the formatting in your message.
(Warning 30/12/2011: Using Emacs 24 this produces weird spaces in long paragraphs when messages are viewed in gmail. Definitely test…)
The following only works since Emacs 23, where
‘truncate-lines’ was introduced. We can use Emacs’s built-in word-wrapping functionality and avoid
‘use-hard-newlines’ entirely with the following (source):
(defun harden-newlines () (save-excursion (goto-char (point-min)) (while (search-forward "\n" nil t) (put-text-property (1- (point)) (point) 'hard t)))) (setq fill-flowed-display-column nil) (add-hook 'message-setup-hook (lambda () (when message-this-is-mail (turn-off-auto-fill) (setq truncate-lines nil word-wrap t use-hard-newlines t)))) (add-hook 'message-send-hook (lambda () (when use-hard-newlines (harden-newlines)))) (add-hook 'gnus-article-mode-hook (lambda () (setq truncate-lines nil word-wrap t)))
The gotcha here is to avoid using
‘use-hard-newlines’ entirely, and simply compose a message with long lines. In
‘message-send-hook’ all newlines are converted to hard newlines, forcing Gnus to post a
format=flowed messages, preserving the existing formatting.
By default, composing a flowed message is only enabled for mail, but it also works for groups coming from mail-to-news gateways such as GMane. Change
‘message-setup-hook’ accordingly if you wish to do that.
You can also customize
‘gnus-treat-fill-long-lines’ to prevent gnus from wrapping long lines. Not sure if this is the same thing as the format=flowed stuff above, but I always land on this page when trying to remember how to disable “word wrap” in gnus :).