4

When I'm writing the docstring for a defun or a defvar, if hit M-q the paragraph always gets filled to 65 characters, regardless of the value of fill-column.

Q. How can I get fill-paragraph to always respect the configured fill-column inside emacs-lisp-mode?

Malabarba
  • 22,878
  • 6
  • 78
  • 163

2 Answers2

6

Change emacs-lisp-docstring-fill-column to nil. From the docstring (emphasis mine):

Value of fill-column to use when filling a docstring. Any non-integer value means do not use a different value of `fill-column' when filling docstrings.

Please don't do this, though. There is a reason for this setting: Emacs shows docstrings exactly like the appear in your code. If you fill your docstrings at 80 characters, you force your readers to read them filled at 80 characters. Even those readers, who view docstrings on their 11 inch laptops in horizontally split buffers. And they have no chance to change the filling in any way.

  • Actually, I want to *reduce* the width so that they fit in my blog's code blocks. It's not for actual development. – Malabarba Mar 03 '15 at 17:20
  • @Malabarba Well, that's a valid reason, of course, but I'll leave the warning in my answer, for other readers. –  Mar 04 '15 at 09:02
3

In emacs-lisp-mode the fill-paragraph-function is set to lisp-fill-paragraph. There is a separate fill column used specifically for docstrings, seeemacs-lisp-docstring-fill-column.

From the variable documentation, you can set emacs-lisp-docstring-fill-column to any non-integer value to make it use the current fill-column instead.

glucas
  • 20,175
  • 1
  • 51
  • 83