Skip to content
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

Add information about using Emacs with darker #348

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,35 @@ You can though ask vim to run ``darker`` on file save with the following in your

Vim should automatically reload the file.

Emacs
-----

You can integrate with Emacs using Steve Purcell's `emacs-reformatter`__ library.

Using `use-package`__:

.. code-block:: emacs-lisp

(use-package reformatter
:hook ((python-mode . darker-reformat-on-save-mode))
:config
(reformatter-define darker-reformat
:program "darker"
:stdin nil
:stdout nil
:args (list "-q" input-file))


This will automatically reformat the buffer on save.

You have multiple functions available to launch it manually:

- darker-reformat
- darker-reformat-region
- darker-reformat-buffer

__ https://github.com/purcell/emacs-reformatter
__ https://github.com/jwiegley/use-package

Using as a pre-commit hook
==========================
Expand Down