Giter Site home page Giter Site logo

Comments (11)

mandarvaze avatar mandarvaze commented on July 16, 2024 2

@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.

ideasman42 avatar ideasman42 commented on July 16, 2024 2

Melpa now points to a fork of this package maintained here: https://github.com/ideasman42/emacs-py-autopep8

from py-autopep8.el.

lafrenierejm avatar lafrenierejm commented on July 16, 2024

@wizmer This repo looks thoroughly unmaintained to me. I would welcome your fork.

from py-autopep8.el.

jennykwan avatar jennykwan commented on July 16, 2024

@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.

wizmer avatar wizmer commented on July 16, 2024

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.

tavurth avatar tavurth commented on July 16, 2024

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.

mandarvaze avatar mandarvaze commented on July 16, 2024

@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.

tavurth avatar tavurth commented on July 16, 2024

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.

mandarvaze avatar mandarvaze commented on July 16, 2024

@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.

tavurth avatar tavurth commented on July 16, 2024

@mandarvaze Yep, that I mentioned in my post, did you try installing black already?

from py-autopep8.el.

ideasman42 avatar ideasman42 commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.