Comparing Python Modes for Emacs

So, I have Emacs 24.3, and with it a fairly recent python.el file appears, providing Python mode for editing.

But I continue to read that there is python-mode.el on Launchpad , and comparing the two files that it pops up to me, that the first one is under 4000 lines, while the last is almost 20,000. This suggests that the latter much more functional.

And I cannot find any comparison of functions on the Internet, documentation, or at least a list of features for each of them. Yes, there is syntax highlighting and a built-in interpreter, but what about completion in the shell buffer, completion in the source file buffer, auto index, reindent, etc.

So what are the important features of these modes? (Or any other Python mode for Emacs that you recommend.) Please provide detailed answers.

+42
python emacs
Mar 27 '13 at 10:10
source share
2 answers

I was a user of python-mode.el once, but stopped using it a year ago because I felt that it was designed, was poorly organized. Here is a list of the note I took at that time. But I must warn you that almost a year has passed since then, so the situation can be changed.

  • Many copy and paste features.
  • A lot of randomly working code. For example, not bypassing variables, but using implicit binding. This causes a lot of compilation errors (and will not work if you change it to the lexical domain).
  • Rough fixation granularity. I am posting a patch and it was committed with unrelated changes.

One thing that I like about python-mode.el is the automatic test suite (although I never ran it). Python.el doesn't have a test suite yet. But I know that the author of python.el is writing it now.

Although python.el is compact, it does not mean that you get poor functionality. It is more like keeping the kernel small and letting others expand it by providing a compressed API. The same author python.el wrote python-django.el to extend python.el for django projects. I wrote an autocomplete plugin for Python called Jedi.el and an advanced IPython plugin called EIN . Both of them have better support for python.el than python-mode.el (well, because I don't use python-mode.el, though).

I had a few things that I missed first from python-mode.el, but they were quickly fixed in python.el (Of course, this probably means that I did not use as many functions in python-mode.el).

what about completion in shell buffer, completion in source file buffer, autoindent, repeat, etc.

  • completion in shell buffer: This works in both python.el and python-mode.el. But sometimes this does not work if you have a bad combination of the Emacs version and the python version (-mode) .el. So python.el is probably safer. But if you need a better solution, use EIN :)

  • completion in the buffer of the source file: Just use Jedi.el :)

  • auto-indent / indent: I donโ€™t know which one is better in performance. However, the keybind for the return is different. In python-mode.el, if you type RET, you get autoindent. In python.el, RET does not indent you, and you should use Cj instead. In fact, Cj for newline + indentation is universal behavior in Emacs. So python.el is better if you program in other languages.

+21
Mar 28 '13 at 1:01
source share

Being actively involved in the development of python-mode.el in recent years, my comment is probably biased: recommend staying with python.el for beginners of Emacs. Also, its author deserves recognition for some useful approaches.

python-mode.el is designed to improve editing performance. This makes it easier to run or execute through python2 and python3 or IPython shells in parallel.

It reduces the number of keystrokes required by providing individual commands. It makes changes faster, helps to program using speech, input using macros, etc.

Supports Python functions currently unknown from python.el:

py-up, py-down - move nested blocks

Avoid sampling samples at a point, sentence, for example:

 py-backward-clause py-copy-clause py-down-clause 

...

No need to configure when testing different versions:

 py-execute-clause-python2 py-execute-clause-python3 py-execute-clause-ipython 

...

  • fine grain concept - py-expression , py-minor-expression
  • commands that execute versions and parallel (I) Python executables, no need to override Python by default
  • largely eliminating the need for the active region noted earlier, see py-execute-line and the whole group more

Browse through the menu for an overview. The doc directory lists the commands.

As your code improves: a way to compare both modes probably checks for the errors listed at http://debbugs.gnu.org/ . See For example, error No. 15510, No. 16875; or http://lists.gnu.org/archive/html/help-gnu-emacs/2014-04/msg00250.html

Commented on "coarse grit fixation": while tkf is basically looking for smaller parts correctly, sometimes the conditions make me leave the rule. Significant parts are not written manually, but by programs located in the "devel" directory. They create files used in the frist development branch - i.e. Components-python-mode. When launching a new function, it is often not obvious if the chosen path is fruitful. After a hundred is completed, or it may be impossible or not recommended. Instead of publishing all the meanders, they used this experimental branch for several days in these cases and checked when the tests passed.

BTW It is assumed that tkf does not refer to compilation errors - which will be searched instantly, but to compiler warnings. Unfortunately, Emacs mixes a reinforced style preference warning with real errors.

+6
Apr 02 '13 at 10:01
source share



All Articles