Comments (11)
@tavurth I had black
which I removed cause I wanted to use autopep8
formatter instead of black
Anyway, Henrik (DOOM emacs creator) suggested how to get it working using set-formatter
command - which now works for me.
Edit:
If anyone comes looking, see this on how to use autopep8 with Doom emacs
I'm not using this package (i.e. py-autopep8.el) anymore with Doom. Just autopep8
directly (With Doom emacs)
from py-autopep8.el.
Melpa now points to a fork of this package maintained here: https://github.com/ideasman42/emacs-py-autopep8
from py-autopep8.el.
@wizmer This repo looks thoroughly unmaintained to me. I would welcome your fork.
from py-autopep8.el.
@wizmer Do you have any interest in maintaining a fork? Or help me do it (I have no experience with melpa packaging)? I would love to have minor-mode in. I'm also looking to extend this to work with pyenv-mode
.
from py-autopep8.el.
Hi,
So apparently one day I wrote that https://github.com/wizmer/py-autopep8.el/tree/minor-mode
I don't remember if it works, maybe that could be the starting point for your py-env
extension. I can maintain the fork or help you do it. It would be good if we can get back the ownership on Melpa, I'll have a look one of these day but not now as I am already pretty busy.
from py-autopep8.el.
I used to run this code:
pip3 install autopep8
(defcustom python-autopep8-path (executable-find "autopep8")
"autopep8 executable path."
:group 'python
:type 'string)
(defun python-autopep8 ()
"Automatically formats Python code to conform to the PEP 8 style guide.
$ autopep8 --in-place --aggressive --aggressive <filename>"
(interactive)
(when (eq major-mode 'python-mode)
(shell-command
(format "%s --in-place --aggressive %s" python-autopep8-path
(shell-quote-argument (buffer-file-name))))
(revert-buffer t t t)))
(bind-key "C-c C-a" 'python-autopep8)
(eval-after-load 'python
'(if python-autopep8-path
(add-hook 'before-save-hook 'python-autopep8)))
Found and modified from this link
But now my doom.el handles formatting for me.
from py-autopep8.el.
@tavurth How do I use this with DOOM emacs ? the "original" instructions from this repo i.e.
(require 'py-autopep8)
(add-hook 'python-mode-hook 'py-autopep8-enable-on-save)
are not working for me.
I can not even manually call M-x py-autopep8-buffer
- it does not even appear when I type M-x
from py-autopep8.el.
Hi @mandarvaze!
Please make sure the following two lines in your doom init.el
are uncommented:
(format +onsave) ; automated prettiness
...
python
Then when you save a python file, check your Messages (C-x B *Messages*
) buffer for errors, as I remember there where two applications I had to install to get it autoformatting, one was black
(pip install black
) and the other I've forgotten.
If you're having trouble, the doom emacs guys are very helpful and can probably help better than I.
from py-autopep8.el.
@tavurth Thanks for the suggestion to check *Messages*
buffer
I keep seeing Error: (error "You need the \"black\" command. You may be able to install it via \"pip install black\".")
in the *Messages*
buffer.
I already have (format +onsave)
and python
enabled in init.el
I'm also using lsp
- I think the above is coming from lsp
(But I could be wrong)
I've already posted on doom-emacs discord server. Waiting for response.
from py-autopep8.el.
@mandarvaze Yep, that I mentioned in my post, did you try installing black
already?
from py-autopep8.el.
Recently I've updated this package with fixes/improvements. Since it seems the original author is not active anymore, I'll check if Melpa could point to my repository instead.
Note that I tried mailing "Friedrich Paetzke" using the fastmail.fm
email from git, but it bounced.
from py-autopep8.el.
Related Issues (16)
- go--apply-rcs-patch is void HOT 11
- Request: Add py-autopep8.el to MELPA HOT 4
- Code loss with autopep8! HOT 1
- Error in emacs 24 HOT 3
- avoiding ^M when using py-autopep8 on Windows HOT 12
- hanging autopep8.py hangs emacs HOT 4
- "Error: Cannot open load file: py-autopep8"
- Inability to add agressiveness levels higher than 1 HOT 2
- autopep8 command not found HOT 8
- Docformatter, docformatter everywhere
- Error: (error "autopep8 command not found.") on Windows HOT 4
- kill ring is modified when py-autopep8-enable-on-save hook is triggered HOT 3
- Would like to disable the hook on a per buffer basis HOT 3
- setup.cfg ignored HOT 4
- File mode specification error: (args-out-of-range 0 0) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py-autopep8.el.