1

Wit this text:

> Play with it a few times you will see my point. The command you need is:
> 
> $ echo hello

When I use Ctrl+q at the 1st line, I get this

> Play with it a few times you will see my point. The
> command you need is: $ echo hello

Where what I need is:

> Play with it a few times you will see my point. The
> command you need is:
>
> $ echo hello

In short, emacs seems not able to tell where the paragraph ends if it is quoted.

Tankman六四
  • 213
  • 1
  • 4

1 Answers1

3

If I understood correctly, you are looking for the command message-fill-yanked-message, which is bound to C-c C-q in message-mode by default. See the Message Manual node on Insertion for a brief description of this command, including a caveat.

In fact, message-mode is so powerful and flexible that I recommend reading its whole manual, which is relatively short, and/or reading through the user options it provides in M-x customize-group RET message RET.

Note that message-fill-yanked-message obeys the buffer-local variable fill-column and fills every paragraph in the message. For filling a single paragraph you can use the command message-fill-paragraph, which is not bound to any keys by default. When given a prefix argument, the latter command also justifies the paragraph.

Basil
  • 12,019
  • 43
  • 69
  • `message-fill-yanked-message` is not only *bound* in `message-mode`, it only *exists* in `message-mode`. You get "No Match" if you attempt it in foundation mode. – Tankman六四 Apr 16 '19 at 00:56
  • @Tankman六四 You seem to be misunderstanding how Emacs modes work. `message-fill-yanked-message` does not exist solely in `message-mode`. The function is defined as soon as `message.el` is loaded, and will continue to exist, i.e. be defined, until you unload the library. – Basil Apr 16 '19 at 17:11
  • @Tankman六四 `fundamental-mode` is intended as a bare-bones mode without any features. Specialised editing modes like `text-mode` or `message-mode` depend on the setup that is performed in the eponymous mode function, so their specialised features, such as `message-fill-yanked-message`, will often not work without this setup. It is wrong to assume `message-fill-yanked-message` will work as intended outside of `message-mode` buffers, unless the documentation explicitly says so, or you discover through experimentation otherwise. – Basil Apr 16 '19 at 17:14