Add function to run black on buffer/region
This commit is contained in:
parent
ce0321e9f1
commit
2d96cc2586
@ -1354,6 +1354,17 @@ A function to run a pipenv-aware python repl:
|
||||
(run-python nil nil t))
|
||||
#+END_SRC
|
||||
|
||||
Run black on the current buffer:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun blacken ()
|
||||
(interactive)
|
||||
(let ((start (if (use-region-p) (region-beginning) (point-min)))
|
||||
(end (if (use-region-p) (region-end) (point-max))))
|
||||
(shell-command-on-region start end "black -q -" nil t)))
|
||||
|
||||
(general-def 'normal python-mode-map "C-M-\\" #'blacken)
|
||||
#+END_SRC
|
||||
|
||||
* Hy
|
||||
Python but Lispy!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user