A tiny little zsh
function to open a python module in Emacs
. Assumes that an Emacs
server process is running.
1 2 3 4 5 6 | epy () {
cmd="import $1 as a ; print a.__file__.endswith('.pyc') and a.__file__[:-1] or a.__file__"
file=$(/usr/bin/env python -c $cmd)
echo $file
emacsclient --no-wait $file
}
|
Typing something like
epy django
would display the location of the module (dependent on your PYTHONPATH
so virtualenv
works as well) and then opens it in a running Emacs. Very useful to read sources.