Hacker News new | ask | show | jobs
by juxtapose 638 days ago
Actually, with emacs 29 it should come out of the box.

Open any python file (emacs has a built-in python-mode), M-x eglot, and you are golden.

1 comments

Keep in mind that there are, unfortunately, at least two packages called “python-mode”.

There’s one that is shipped with Emacs, which is maintained by the Emacs maintainers. That’s the one I use and I agree with you that it works very well.

Then there’s a third-party one maintained by some Python project maintainers. Probably, that might be the one “apt install python-mode” will get you.

There is also a “python-ts-mode”. That’s just the built-in Emacs python-mode where the syntax highlighting is replaced with TreeSitter, which provides similar highlighting to other editors like Atom and NeoVim.

In addition, there are some heavier alternatives like elpy and anaconda-mode. But I think most people these days use one of the python-modes with LSP.

Unless you have a good reason to use one of the others, I’d start with the built-in python-mode. It doesn’t really require any setup in itself, just open a *.py file and it’s active without any use-package statement required.

It is however quite bare bones, so you probably want to couple it with e.g. Eglot, Company, Comint-Mime, Code-Cells.el, etc. to get more of a VSCode-like experience in Emacs.

"apt install python-mode" is just verry old (2016) The one in github is from 2023. But both are created in 1992 by Tim Peters.

And they differ greatly:

  diff python-mode.el python-mode.old | wc
  45380  216095 1849879
Aha, I see. The alternative I was thinking of was this Python-mode:

https://wiki.python.org/moin/EmacsPythonMode

It seems that one is on MELPA under the name “python-mode”. It’s a third-party project that replaces the built-in “python-mode”, also actively maintained (last updated last week).