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.

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.

3
  • 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. Apr 16 '19 at 0: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

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.