My expectation is that, like for comments in other language modes besides python, I could write a long comment, say 150 chars, and it would automatically fill, i.e., newline and indent with comment starting newline, or at least allow me to do evil-fill (I use evil-mode) for same, but instead nothing happens. I have to manually format long comment lines that start with #.

In a python file, while in python-mode, when I do M-x auto-fill-mode it disables auto-fill-mode so I know it is turned on. Initially I thought maybe that was it. C-h v auto-fill-mode says its value is -1, not sure if that matters (but it did seem weird since a negative value usually means it is turned off - but in this case, since auto-fill works in """ comments, I know that can't be the case).

Also, it does auto-fill, as I type, comments in a python docstring """ environment.

Perhaps this is default and expected behavior (for most python programmers), I don't know.

Does your Python config auto-fill # style comments? Have an idea what to look for to make it do this?

Update: I do find that filladapt-mode mostly resolves the issue: (1) It nicely handles filling inside a """ style comment, (2) but, while it does fill inside a # style comment, it does not automatically start each newline with a # character. Not a big deal but something I need to see about enabling.

Update: Actually, I finally found a setup that works great for filling both style python comments. I give the use-package config I use to enable it in my answer below.

1 Answer 1


Using filladapt with the following very simple config worked well to solve the issue I described above:

(use-package python
  :after filladapt
  (filladapt-mode 1))
  • 1
    FYI: You can choose your own answer as the accepted answer.
    – Drew
    Dec 5, 2019 at 21:00

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.