emacs-devel
[Top][All Lists]
Advanced

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

python.el: reuse (sometimes) Python comint buffer


From: Bojan Nikolic
Subject: python.el: reuse (sometimes) Python comint buffer
Date: Thu, 03 Dec 2009 22:43:41 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hello,

The run-python function in Emacs 22 python.el used to reuse comint
buffers, which I found very useful. The attached patch I think gets
back close to this behaviour, i.e.:

  If buffer python-buffer is live and "new" hasn't been specified that
  buffer is reused and the new comint process is started
  there. Otherwise it is started in a newly created buffer.

Hope it is useful for others and/or suitable for applying to trunk.

Best,
Bojan

--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1562,7 +1562,10 @@
               ;; Suppress use of pager for help output:
               (process-connection-type nil))
          (apply 'make-comint-in-buffer "Python"
-                (generate-new-buffer "*Python*")
+                (if (and (buffer-live-p python-buffer)
+                         (not new))
+                    python-buffer
+                  (generate-new-buffer "*Python*"))
                 (car cmdlist) nil (cdr cmdlist)))
       (setq-default python-buffer (current-buffer))
       (setq python-buffer (current-buffer))

-- 
Bojan Nikolic          ||          http://www.bnikolic.co.uk

reply via email to

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