Welcome, guest | Sign In | My Account | Store | Cart

A tiny little zsh function to open a python module in Emacs. Assumes that an Emacs server process is running.

Bash, 6 lines
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.

Created by Noufal Ibrahim on Mon, 19 Jul 2010 (MIT)
Bash recipes (41)
Noufal Ibrahim's recipes (10)

Required Modules

  • (none specified)

Other Information and Tasks