I have yapf installed, and would like to run it automatically. Documentation says there is a way: http://elpy.readthedocs.io/en/latest/ide.html#command-elpy-format-code but I don't see it in the source code.

PS. It's not important that it come from Elpy. If there's an alternative ready-made solution, it's just as good.


elpy-format-code is available in elpy. You can run it with C-c C-r f or M-x elpy-format-code.

If you want to run it automatically, you can use buffer hooks or a timer to run whenever you want.

| improve this answer | |
  • Can you tell when was this added? I have 1.8.0 and it doesn't have this function. – wvxvw May 18 '17 at 12:26
  • It is added in 1.11. Current version is 1.15. – ChillarAnand May 19 '17 at 4:44

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.