C-h v fill-column gives me 80.

Pasting the lorem ipsum text in *scratch* (lines longer than 80) then going M-x fill-paragraph fills around column 66.

The same in c-mode. In this mode, comment wraps seem to work, but not raw text outside code.

If I switch to text-mode, filling paragraphs work as I expect (column 80).

What makes it fail in *scratch* and in c-mode?

  • It should also work in fundamental mode. Only not in program modes
    – Rusi
    Jan 28, 2020 at 9:00
  • @Rusi it is possible that my scratch wasn't in fundamental mode anymore. Why shouldn't it work in program modes?
    – Gauthier
    Jan 28, 2020 at 9:41
  • Can't say for sure. Surely the notion of paragraph doesn't make much sense for program modes. But why it works with some default value of fill-column (instead of just not having that key bound)... Dunno. I'd say it's a bug
    – Rusi
    Jan 28, 2020 at 9:45

1 Answer 1


Filling is a general facility which can depend on more than just the fill-column variable, however the first thing to test is simply that you're checking the fill-column value for the correct buffer -- it can have a different value in each buffer; so if you typed C-hv from some other buffer, you might see the wrong value.

C-hf fill-paragraph tells us that its behaviour depends on the value of the fill-paragraph-function variable, which in turn is described thus:

Mode-specific function to fill a paragraph, or nil if there is none.
If the function returns nil, then `fill-paragraph' does its normal work.
A value of t means explicitly "do nothing special".
Note: This only affects `fill-paragraph' and not `fill-region'
nor `auto-fill-mode', so it is often better to use some other hook,
such as `fill-forward-paragraph-function'.

In *scratch* C-hv fill-paragraph-function leads us to:

lisp-fill-paragraph is an interactive compiled Lisp function in

(lisp-fill-paragraph &optional JUSTIFY)

Like M-q, but handle Emacs Lisp comments and docstrings.
If any of the current line is a comment, fill the comment or the
paragraph of it that point is in, preserving the comment's indentation
and initial semicolons.

Similarly, in c-mode buffers we're using the function c-fill-paragraph (which see).

As you might imagine, many of the mode-specific functions use alternative variables with fill-column in their name, so this ought to show you some illuminating things as well:

M-x apropos-variable RET fill-column RET

  • To expand slightly on this, lisp-fill-paragraph temporarily binds fill-column to emacs-lisp-docstring-fill-column if that is set to an integer. It's 65 by default. Customizing it to nil would use the default value of fill-column Aug 28, 2022 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.