help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Restarting the python process in py-shell


From: Neilen Marais
Subject: Restarting the python process in py-shell
Date: Fri, 25 Feb 2011 20:40:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hi,

I'm using emacs 23.1.1 (from Ubuntu 10.10) and ipython using
ipython.el. I often need to re-start my interactive python process while
developing and wanted to define a single keybinding for this. I
experimented and found that the functions needed are
comint-quit-subjob and py-shell. I tried M-x comint-quit-subjob M-x
py-shell when in the *Python* buffer, and it worked OK. Then I tried to
make a function to do it, and included the following snippet in my
init.el:

(defun py-shell-restart-process ()
  "Quit and restart current py-shell process"
  (interactive)
  (comint-quit-subjob)
  (py-shell))
(add-hook 'py-shell-hook (lambda () 
(local-set-key "\C-cr" 'py-shell-restart-process)
))

Pressing C-cr kills the process, but for some reason doesn't re-start
the shell process. What am I doing wrong here?

Thanks
Neilen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]