-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added code formatting with black or ruff #2
base: master
Are you sure you want to change the base?
Conversation
7e177be
to
38752e1
Compare
Set the variable ob-python-extras-formatter to either "ruff" or "black".
37a45f9
to
dd5dca1
Compare
Thanks for the pull request and the work on this project! :) Here are my thoughts:
For instance, to format a buffer with black, there's already the (python-black-buffer) We could use it like this:
For ruff -- I haven't tried this package, but perhaps this: https://github.com/JoshHayes/emacs-ruff-format/blob/main/ruff-format.el ? Both python-black and ruff-format rely on https://github.com/purcell/emacs-reformatter/blob/master/reformatter.el
What do you think about this? |
Use
M-x ob-python-extras-format
to format code blocks (supports ruff and black).(add-hook 'org-babel-after-execute-hook 'ob-python-extras-format)