Function: python-shell-get-buffer
python-shell-get-buffer is a byte-compiled function defined in
python.el.gz.
Signature
(python-shell-get-buffer)
Documentation
Return inferior Python buffer for current buffer.
If current buffer is in inferior-python-mode, return it.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-shell-get-buffer ()
"Return inferior Python buffer for current buffer.
If current buffer is in `inferior-python-mode', return it."
(if (derived-mode-p 'inferior-python-mode)
(current-buffer)
(let* ((dedicated-proc-name (python-shell-get-process-name t))
(dedicated-proc-buffer-name (format "*%s*" dedicated-proc-name))
(global-proc-name (python-shell-get-process-name nil))
(global-proc-buffer-name (format "*%s*" global-proc-name))
(dedicated-running (comint-check-proc dedicated-proc-buffer-name))
(global-running (comint-check-proc global-proc-buffer-name)))
;; Always prefer dedicated
(or (and dedicated-running dedicated-proc-buffer-name)
(and global-running global-proc-buffer-name)))))