[Python-Dev] Any Emacs tips for core developers?
Jared Flatow
jflatow at northwestern.edu
Mon Feb 4 17:32:05 CET 2008
I am not a core developer but I use emacs exclusively for development
so you may find this useful.
On Feb 3, 2008, at 6:53 PM, skip at pobox.com wrote:
> I am also the guy more-or-less responsible for syncing python-mode
> with the
> version delivered as part of the XEmacs packages (last synced about
> a week
> ago). The GNU Emacs folks wrote their own Python mode from scratch
> a couple
> years ago. Both are mentioned here:
>
> http://www.emacswiki.org/cgi-bin/wiki/PythonMode
>
> I have no experience with the GNU Emacs code.
I recently upgraded to the emacs 22.1/python.el which I tried *really*
hard to use, but eventually ended up installing python-mode again.
There are a number of problems in the emacs lisp that I was able to
get around, but eventually the bugginess overcame my will:
*R, RE, and RET (i.e. the keystroke shift-r) were bound to commands in
the major mode (meaning you couldn't type an R without triggering
python-send-string). You can comment out this line in python.el to get
around this:
;; (define-key map "\C-c\C-s" 'python-send-string)
*echoing was occurring in the run-python shell. You can easily tell
comint to process echoes for single-line commands, but if your tabs
are converted to spaces you would need to do something like this to
get rid of it in general:
;(add-hook 'inferior-python-mode-hook
; (lambda ()
; (setq comint-process-echoes t)
; (set (make-variable-buffer-local 'indent-tabs-mode) nil)))
* The emacs.py never worked for me (I ended up completely disabling it)
* Opening a run-python shell when you already have one open does not
work as you would expect. This is fixable also, but this was also the
final straw for me.
Realizing these things is very painful. Therefore I definitely
recommend python-mode.el, which you can install by adding this to
your .emacs:
;; Use a real man's python-mode
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode)
interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
(autoload 'py-shell "python-mode" "Python shell." t nil)
Assuming the .el files are on your load-path and the .py files are in
your site-packages.
jared
More information about the Python-Dev
mailing list