r/Python • u/michaelherman • Nov 30 '15
Emacs - the best python editor?
https://realpython.com/blog/python/emacs-the-best-python-editor#.VlxbmNNKXbw.reddit13
22
u/jdreaver Nov 30 '15
If someone is just looking for a great Python IDE, then I recommend something besides Emacs, like PyCharm. However, I use Emacs because I get a uniform environment for all of the languages I use. I also use org-mode for all of my planning and time tracking, erc for IRC chat, mu4e for email, and a few other miscellaneous utilities. Basically, don't get into Emacs simply expecting to get a good Python IDE. Treat learning to use Emacs like its own investment, and maybe you'll like using it for all of your text editing.
Every time someone shows a language-specific Emacs setup on Reddit, half of the comments are variations of: "why should I do this when I have great IDEs available for X language? This is a waste of time, I am a practical developer and I need to write code now, not futz with elisp!" Learning Emacs is definitely a labor of love at times, but there are also real productivity gains.
4
u/redsymbol Nov 30 '15
Seconded. I invested the time to really learn Emacs about a decade ago. One of the smarter tactical decisions I've made it my career - it's paid massive productivity dividends over time.
5
2
u/ermass Dec 01 '15
I totally agree with your first paragraph, but almost totally disagree with the second one :)
Every time someone shows a language-specific Emacs setup on Reddit, half of the comments are variations of: "why should I do this when I have great IDEs available for X language? This is a waste of time, I am a practical developer and I need to write code now, not futz with elisp!" Learning Emacs is definitely a labor of love at times, but there are also real productivity gains.
I can understand why they say "why...". It actually applies very well to this post as well. It starts from the installing Emacs, thus assuming a person following it as a beginner with Emacs. There is a learning curve and configuration pain ahead. A modern Python project has its own infrastructure: git repo, virtual environments, dependency management, debugging, web or other framework, javascript, html, bash. Community edition of PyCharm has support for all of these either builtin or as plugins. Moreover, if you write also in Ruby or Java there are similar IDE by the same vendor, which make the experience uniform. And after all, I don't think that productivity of emacs user will be higher, unless in very specific scenarios. I also believe, that while emacs is truly awesome, but some of its old users would have preferred PyCharm had they have this option back then.
5
u/dzecniv Nov 30 '15 edited Nov 30 '15
I'd had a couple things to the article:
remind that we can interactively go to methods' definition with helm-imenu
indexing sources and interactively going to tags with helm-cscope
and more: set the current venv, sort import statements, pip-requirements mode, using
M-x shellwhere everything is text, programmatically move around code,…
3
Nov 30 '15
All good stuff! I wanted to keep the article simple as a way to get started with the basics.
25
u/Kwpolska Nikola co-maintainer Nov 30 '15
Did you mean vim?
16
u/dysprog Nov 30 '15
EMACS and VIM: The best user interface the 1970's have to offer.
4
4
u/_AACO It works!? Nov 30 '15
You might not believe but both of them have a GUI very similar to modern text editors.
3
u/brews import os; while True: os.fork() Dec 01 '15
"Similar"
1
2
u/gfixler Dec 01 '15
Which is ridiculous, because GUIs are not where the power is. "Modern" doesn't mean "better."
3
-2
u/Kwpolska Nikola co-maintainer Nov 30 '15
What is your favorite “modern” editor? Can I run it anywhere in the world over SSH? Or at least on a modestly-specced machine (that chokes on Atom and is completely unusable with JetBrains garbage)?
9
u/idlecore Nov 30 '15
https://en.wikipedia.org/wiki/Betteridge's_law_of_headlines
This won't be a popular opinion, but someone should bring it up already.
With so many great python editors and IDEs out there, that do all the things you need, and more, right out of the box, you really have to wonder why someone would advocate the use of an editor that requires so much tweaking and still ends up highlighting the print built-in function as a statement, as you can see on several images in the original article.
The right programming tools for anyone is largely a matter of scope, context and preference, with a huge spectrum of valid possibilities, and sometimes that includes using a low-level editor like emacs or vi. However the majority of times someone advocates the use of these 'medal of honor' editors, they do it with the thinly veiled objective of showing everyone that they can, rather than should.
So to me this constant stream of 'emacs/vi is a great IDE for language X' articles is resembling more and more simple self promoting bullshit, rather than genuine expert advice.
4
u/jdreaver Nov 30 '15
If you are looking for an IDE for a single language, then yes, Emacs is probably overkill. However, a lot of people use Emacs as an IDE for multiple languages, for text editing in general, organization, email, IRC, blogging, writing documents, and the list goes on. There is definitely value in having a uniform and familiar interface for seemingly disparate tasks, not to mention the individual modes for these tasks are also usually high quality pieces of software in their own right.
1
u/ermass Dec 01 '15
I am not /u/idlecore, but I think idlecore's point was that title and the way it's written is self promoting. If title read something like "Emacs setup for Python development" or "here is my setup" and went straight to the description of installed packages and .emacs files, not pretending to cover needs of the entire community, it'd be more honest.
-3
u/twillisagogo Nov 30 '15
simple self promoting bullshit
pretty much the definition of everything posted on reddit including these comments.
let's bitch about our favorite libs instead.
1
u/5erif φ=(1+ψ)/2 Dec 01 '15
Apparently not on OS X. I've spent 4 hours just trying to get it to load without errors. [Link.] During this time I've switched from the default Apple Python distro to Anaconda, un/re-installed emacs, and tried spacemacs, which is now saying: "Wrong type or argument: (or eieio-object-p class-p), nil"
3
u/bastibe Dec 01 '15
Notice how you have two "defvar" blocks in your init.el. The defvar block must come before the "mapc" block, where it is used. Since you define elpy only in the second (unused) defvar, elpy is not installed. Hence your left error.
Your right error says that it can't load "package", which probably means that you are running emacs 23. Package was introduced in Emacs 24. On your screenshots, this error only happens in the console emacs, which is probably still your OSX default Emacs. Install emacs from
brew, or add your graphical emacs installation to your path to fix this error.1
u/5erif φ=(1+ψ)/2 Dec 01 '15
Thanks, I'm now running GNU Emacs 25.1.50.1. Strange things are still happening, and that may be because when installing emacs through brew, I see a message that the emacs version for OS X 10.11 is still beta and unsupported. I'm going to keep trying. I like vim, and emacs seems like it could have even more advantages. IPython integration looks cool, for example.
2
-3
18
u/[deleted] Nov 30 '15
Let the VIM-Emacs Holy War begin!