1

I would like to edit e-mail messages without the header (!) in message mode. If I open a file in message mode and it does not have the usual e-mail headers, then M-q filling does not work as I discovered in this question. In that question I learned that the header separator can be customized, but what if there is no header and no header separator at all?

I understand that sending the mail will not work without this header, but I send the mail on a different route. Actually, this is part of trying to use Emacs as the external editor for MailMate which works fine, except that I have not found a mode in which I can edit e-mail with font-locking for quote depth etc. Probably this should be a minor mode for editing e-mail which does not exist yet. notmuch-mode, mu4e-mode and org-msg all seem to be based on message mode and behave the same wrt. the header.

So is it possible to use message mode without a header?

1
  • I already tried to set the variable mail-header-separator to an empty string or just a space. This does not work. Dec 5 '20 at 19:31
1

So is it possible to use message mode without a header?

Would narrowing to the body work in your use case? See (info "(emacs) Narrowing"). For example, you could C-c C-b (message-goto-body), C-SPC (set-mark-command), M-> (end-of-buffer), C-x n n (narrow-to-region). To undo the narrowing, you could C-x n w (widen).

Here's a command that does this in one go:

(defun my-message-narrow-to-body ()
  "Narrow buffer to Message body."
  (interactive)
  (narrow-to-region (save-excursion (message-goto-body) (point))
                    (point-max)))
3
  • If I understand correctly, this does something else. I have a buffer with just the content of the e-mail, no header. (message-goto-body) takes me to the beginning of the buffer, then the narrowing is a no-op. The function message-fill-paragraph will behave as if I'm in the header because I am before the header separator (which never appears in the buffer). Dec 5 '20 at 19:26
  • Ah, I was thinking of the case where the headers are still there, but you can hide them by narrowing. I don't know why you would want or expect a major mode to work outside of its intended context.
    – Basil
    Dec 5 '20 at 22:11
  • I don’t know of any minor mode to do what I want: Be like message mode when editing the body. There is org-msg minor mode which I just discovered and I will have to try. Dec 6 '20 at 7:37

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.