On Tue, Mar 28 2017, Eduardo Mercovich wrote:
>> Yeah, mu4e-fill-paragraphs doesn't recognize the concept of a
>> 'message
>> signature'. I think the solution would be (in
>> `mu4e-fill-paragraph') to
>> narrow the buffer to just the body part before calling
>> `fill-paragraph'.
[...]
> I believe this should be the standard behavior: `fill-paragraph'
> shouldn't mess
> with the signature.
Yes. And I just took a quick look at the code again and noticed
that the actual culprit is actually, mu4e, not fill-paragraph (or
message-fill-paragraph, which is what actually does the filling).
The function that is called when you fill a paragraph in a mu4e
message buffer is `mu4e-fill-paragraph', which contains a call to
`delete-trailing-whitespace' before it calls `fill-paragraph'.
I don't really understand why that call is there, in fact I would
think it'd be better to just delete it. But I'm sure Dirk has a
reason for it, so I'll let him comment on it.
I don't know how one can reliably narrow the buffer to the body of
the message. What you can do until Dirk fixes the issue is to
redefine `mu4e-fill-paragraph' in your init file after loading
mu4e:
```
(with-eval-after-load 'mu4e
(defun mu4e-fill-paragraph (&optional region)
"If `use-hard-newlines', takes a multi-line paragraph and
makes
it into a single line of text. Assume paragraphs are separated
by blank lines. If `use-hard-newlines' is not enabled, this
simply executes `fill-paragraph'.
This is a redefinition of the original function that removes the
calls to `delete-trailing-whitespace'."
;; Inspired by
https://www.emacswiki.org/emacs/UnfillParagraph
(interactive (progn (barf-if-buffer-read-only) '(t)))
(if mu4e-compose-format-flowed
(let ((fill-column (point-max))
(use-hard-newlines nil)) ; rfill "across" hard
newlines
(fill-paragraph nil region))
(fill-paragraph nil region))))
```
Or define this function under a different name (e.g.,
`my-mu4e-fill-paragraph') and bind that to M-q.
HTH