aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-08-06 00:27:43 -0300
committerFabián Ezequiel Gallina2012-08-06 00:27:43 -0300
commitba7b015436fce401af7f40d1ee8dcc08cdf2541a (patch)
tree3caafa345b90c9f3bd74d451ed4692cd284c63b4
parent5eaeacb595f4432c598cdd9f4c11763648983f62 (diff)
downloademacs-ba7b015436fce401af7f40d1ee8dcc08cdf2541a.tar.gz
emacs-ba7b015436fce401af7f40d1ee8dcc08cdf2541a.zip
Make internal shell process buffer names start with space.
* progmodes/python.el (python-shell-make-comint): Add optional argument INTERNAL. (run-python-internal): Use it. (python-shell-internal-get-or-create-process): Check for new internal buffer names.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/python.el37
2 files changed, 31 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 484a5c5cedf..a8ee033a65d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12012-08-06 Fabián Ezequiel Gallina <fgallina@cuca>
2
3 Make internal shell process buffer names start with space.
4 * progmodes/python.el (python-shell-make-comint): Add optional
5 argument INTERNAL.
6 (run-python-internal): Use it.
7 (python-shell-internal-get-or-create-process): Check for new
8 internal buffer names.
9
12012-08-06 Glenn Morris <rgm@gnu.org> 102012-08-06 Glenn Morris <rgm@gnu.org>
2 11
3 * eshell/esh-ext.el (eshell/addpath): Use dolist. 12 * eshell/esh-ext.el (eshell/addpath): Use dolist.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f946509d6e0..01c17a70f98 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1546,26 +1546,34 @@ variable.
1546 python-syntax-propertize-function)) 1546 python-syntax-propertize-function))
1547 (compilation-shell-minor-mode 1)) 1547 (compilation-shell-minor-mode 1))
1548 1548
1549(defun python-shell-make-comint (cmd proc-name &optional pop) 1549(defun python-shell-make-comint (cmd proc-name &optional pop internal)
1550 "Create a python shell comint buffer. 1550 "Create a python shell comint buffer.
1551CMD is the python command to be executed and PROC-NAME is the 1551CMD is the python command to be executed and PROC-NAME is the
1552process name the comint buffer will get. After the comint buffer 1552process name the comint buffer will get. After the comint buffer
1553is created the `inferior-python-mode' is activated. If POP is 1553is created the `inferior-python-mode' is activated. When
1554non-nil the buffer is shown." 1554optional argument POP is non-nil the buffer is shown. When
1555optional argument INTERNAL is non-nil this process is run on a
1556buffer with a name that starts with a space, following the Emacs
1557convention for temporary/internal buffers, and also makes sure
1558the user is not queried for confirmation when the process is
1559killed."
1555 (save-excursion 1560 (save-excursion
1556 (let* ((proc-buffer-name (format "*%s*" proc-name)) 1561 (let* ((proc-buffer-name
1562 (format (if (not internal) "*%s*" " *%s*") proc-name))
1557 (process-environment (python-shell-calculate-process-environment)) 1563 (process-environment (python-shell-calculate-process-environment))
1558 (exec-path (python-shell-calculate-exec-path))) 1564 (exec-path (python-shell-calculate-exec-path)))
1559 (when (not (comint-check-proc proc-buffer-name)) 1565 (when (not (comint-check-proc proc-buffer-name))
1560 (let* ((cmdlist (split-string-and-unquote cmd)) 1566 (let* ((cmdlist (split-string-and-unquote cmd))
1561 (buffer (apply 'make-comint proc-name (car cmdlist) nil 1567 (buffer (apply #'make-comint-in-buffer proc-name proc-buffer-name
1562 (cdr cmdlist))) 1568 (car cmdlist) nil (cdr cmdlist)))
1563 (current-buffer (current-buffer))) 1569 (current-buffer (current-buffer))
1570 (process (get-buffer-process buffer)))
1564 (with-current-buffer buffer 1571 (with-current-buffer buffer
1565 (inferior-python-mode) 1572 (inferior-python-mode)
1566 (python-util-clone-local-variables current-buffer)) 1573 (python-util-clone-local-variables current-buffer))
1567 (accept-process-output (get-buffer-process buffer)))) 1574 (accept-process-output process)
1568 (and pop (pop-to-buffer proc-buffer-name t)) 1575 (and pop (pop-to-buffer buffer t))
1576 (and internal (set-process-query-on-exit-flag process nil))))
1569 proc-buffer-name))) 1577 proc-buffer-name)))
1570 1578
1571;;;###autoload 1579;;;###autoload
@@ -1611,11 +1619,10 @@ are set to nil for these shells, so setup codes are not sent at
1611startup." 1619startup."
1612 (let ((python-shell-enable-font-lock nil) 1620 (let ((python-shell-enable-font-lock nil)
1613 (inferior-python-mode-hook nil)) 1621 (inferior-python-mode-hook nil))
1614 (set-process-query-on-exit-flag 1622 (get-buffer-process
1615 (get-buffer-process 1623 (python-shell-make-comint
1616 (python-shell-make-comint 1624 (python-shell-parse-command)
1617 (python-shell-parse-command) 1625 (python-shell-internal-get-process-name) nil t))))
1618 (python-shell-internal-get-process-name))) nil)))
1619 1626
1620(defun python-shell-get-process () 1627(defun python-shell-get-process ()
1621 "Get inferior Python process for current buffer and return it." 1628 "Get inferior Python process for current buffer and return it."
@@ -1662,7 +1669,7 @@ there for compatibility with CEDET.")
1662(defun python-shell-internal-get-or-create-process () 1669(defun python-shell-internal-get-or-create-process ()
1663 "Get or create an inferior Internal Python process." 1670 "Get or create an inferior Internal Python process."
1664 (let* ((proc-name (python-shell-internal-get-process-name)) 1671 (let* ((proc-name (python-shell-internal-get-process-name))
1665 (proc-buffer-name (format "*%s*" proc-name))) 1672 (proc-buffer-name (format " *%s*" proc-name)))
1666 (when (not (process-live-p proc-name)) 1673 (when (not (process-live-p proc-name))
1667 (run-python-internal) 1674 (run-python-internal)
1668 (setq python-shell-internal-buffer proc-buffer-name) 1675 (setq python-shell-internal-buffer proc-buffer-name)