This package contains three extensions to python-mode which I find useful when programming python. They are:
They are packaged separately so that one may choose which to use.
I really like to run and debugging python programs from inside of emacs but I have wanted to see a couple of additional features added to python-mode.el This applies to executing the program as well as running with a symbolic debugger.
To use these extensions, py-mode-ext.el is placed in my emacs load path. See the code that I inserted into my .emacs file below.
When the user invokes py-execute-prog or py-call-pdb, the following sequence occurs.
When the user initiates the command for pychecker, it will check whether any buffers have been changed and ask whether you want any of those saved. Then it will run PyChecker against the file behind the current buffer.
pyp is a pair of functions which facilitate adding print statements to a python module. They are:
I have included an updated version of pycomplete.
This is a nifty emacs extension which helps one to insert
attributes and functions into a python program. For instance, one can
type
I got an early version which was rather limited. Looking around the
net, I found reference to an extension patch. When I applied the
patch, I saw that it was better. So I removed some unnecessary code
from the package and added the facility to distinguish functions and
to end up in the python buffer after the completion. There are two
pieces to the package - pycomplete.el which is loaded by emacs so must
be in the emacs load path and pycomplete.py which should go into an
active site-packages directory or anywhere else in the PYTHONPATH.
This collection of extensions may be downloaded from
Summary Page.
The python mode extensions are installed by placing
"py-mode-ext.el" in the emacs load path specified in the emacs load
path. See below the code I use in my .emacs to activate the
extensions.
To use pyp just move pyp.el to the emacs load path and see the
.emacs code below.
Installation of pycomplete is slightly more complicated. It
requires pymacs which needs to have been installed. For Debian based
systems you can probably use apt-get. Otherwise, get a tarball and
install it from there. Look for "pymacs_0.22.orig.tar.gz". If you
can't find it, I can send you a copy.
I think that pymacs is really great but at present it does not
appear to be supported and the documentation is poor like many Open
Source programs. The main documentation problem I found was a paucity of
examples. For instance, I fussed around for a while before I
discovered that the output of print statements show up in the *Pymacs*
buffer. Pymacs seems to have neither a web site nor a maintainer. Damn
shame!
Fortunately, pymacs is easier to install than to find. Instructions
are in the package and are pretty standard with nothing to
compile. setup.py does everything without compiling anything.
Installation of pycomplete consists of merely moving pycomplete.el
to the emacs load path and pycomplete.py to the PYTHONPATH. Again look
at the .emacs code below.
I have the following code in my .emacs to enable these extensions.
You may contact me at [rozen at mcn dot org] *
os.path.is
then hits Download
Installaton
.Emacs code.
(add-hook 'python-mode-hook
'(lambda ()
(load "py-mode-ext")
(load "pyp")
(require 'pycomplete)
(define-key py-mode-map [f12] 'pyp)
(define-key py-mode-map "\C-c\C-c" 'py-execute-prog)
(define-key py-mode-map "\C-c\C-g" 'py-call-pdb)
(define-key py-mode-map "\C-c\C-w" 'pychecker)))