My Emacs setup [OUTDATED]

Some notes on my emacs setup circa 2015, mostly about Python.

For the latest, see more recent posts tagged emacs and/or my emacs config repo

Python

Which mode?

There is python-mode.el, and python.el. I have settled on python-mode from the elpa repositories.

Why? The built-in python.el is mostly fine, but I am addicted to hitting TAB and having a region of code mostly aligned how I want.

Rope?

I tried ropemacs, and really like it when it works. For simple refactorings it can be very convenient, eg. M-x rope-rename.

But the problem is, it tends to choke on large codebases. At Percolate our largest repo was about 300k lines of Python. Open a file with a lot of imports from that codebase and watch emacs hang. It suddenly becomes nearly impossible to do anything in that buffer.

So, I can live without the nice refactoring feautures.

Jedi!

jedi:goto-definition

Without doubt the single biggest productivity boost in my old python config was this keybinding that takes me to the definition of the method or function invocation I'm looking at:

(add-hook 'python-mode-hook
  (lambda ()
    (define-key python-mode-map (kbd "C-c g") 'jedi:goto-definition)
    ;; ... other stuff ...
  )
)

(The same feature is in Rope as rope-goto-definition, but the jedi version seems to work just as well.)

completion

Jedi completion works reasonably well with no special tweaks.

Flymake

For realtime linting, I currently use the flymake-python-pyflakes package from melpa. I also use flymake-cursor (also from melpa) which shows flymake errors appear in the minibuffer, so I don't have to move the mouse around to see them.

To have a dropdown menu for jumping to function and class definitions in the current buffer:

(add-hook 'python-mode-hook 'imenu-add-menubar-index)