* python-mode: reuse existing *Python* buffer
@ 2006-08-24 15:41 Slawomir Nowaczyk
0 siblings, 0 replies; only message in thread
From: Slawomir Nowaczyk @ 2006-08-24 15:41 UTC (permalink / raw)
Hello,
The following patch makes run-python command reuse *Python* buffer if
it exists but the process associated with it has died (unless `new'
argument is t, of course), as opposed to creating *Python<2>* etc.
It also fixes a bug which sometimes caused an error when new Inferior
Python buffer was being created -- the (python-send-string "import
emacs") was being executed in the current buffer, not in the newly
created one.
**********************************************************************
lisp/ChangeLog:
2006-08-24 Slawomir Nowaczyk <slawek@cs.lth.se>
* progmodes/python.el (run-python): Reuse *Python* buffer when
old process dies
**********************************************************************
--- EmacsCVS/lisp/progmodes/python.el 2006-08-24 14:01:25.633180800 +0200
+++ Emacs/lisp/progmodes/python.el 2006-08-24 16:57:05.349171200 +0200
@@ -1327,8 +1341,8 @@
(cons (concat "PYTHONPATH=" data-directory
(if path (concat ":" path)))
process-environment)))
- (set-buffer (apply 'make-comint-in-buffer "Python"
- (generate-new-buffer "*Python*")
+ (set-buffer (apply 'make-comint-in-buffer "Python"
+ (if new (generate-new-buffer "*Python*") "*Python*")
(car cmdlist) nil (cdr cmdlist)))
(setq-default python-buffer (current-buffer))
(setq python-buffer (current-buffer)))
@@ -1342,9 +1356,10 @@
;; file. The code might be inline here, but there's enough that it
;; seems worth putting in a separate file, and it's probably cleaner
;; to put it in a module.
- (python-send-string "import emacs")
- ;; Ensure we're at a prompt before doing anything else.
- (python-send-receive "print '_emacs_out ()'")
+ (with-current-buffer python-buffer
+ (python-send-string "import emacs")
+ ;; Ensure we're at a prompt before doing anything else.
+ (python-send-receive "print '_emacs_out ()'"))
;; Without this, help output goes into the inferior python buffer if
;; the process isn't already running.
(sit-for 1 t) ;Should we use accept-process-output instead? --Stef
**********************************************************************
--
Best wishes,
Slawomir Nowaczyk
( slawomir.nowaczyk.847@student.lu.se )
Irreverence is another person's disrespect to your god; there isn't
any word that tells what your disrespect to his god is. -- Mark Twain
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-08-24 15:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-24 15:41 python-mode: reuse existing *Python* buffer Slawomir Nowaczyk
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).