aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2014-12-26 17:59:33 -0300
committerFabián Ezequiel Gallina2014-12-26 17:59:33 -0300
commit7284a174abc03c9ccf45aa43c939585beea351b7 (patch)
tree21024e515aa72b5280618d3a6a29f8fd0598a5f5 /lisp/progmodes/python.el
parent8cf42182b8da79bb4a2f2f704fa0d627304f5165 (diff)
downloademacs-7284a174abc03c9ccf45aa43c939585beea351b7.tar.gz
emacs-7284a174abc03c9ccf45aa43c939585beea351b7.zip
python.el: Generate clearer shell buffer names.
* lisp/progmodes/python.el (python-shell-get-process-name) (python-shell-internal-get-process-name): Use `buffer-name`. (python-shell-internal-get-or-create-process): Simplify. * test/automated/python-tests.el (python-shell-get-process-name-1) (python-shell-internal-get-process-name-1): Cleanup. (python-shell-get-process-name-2) (python-shell-internal-get-process-name-2): New tests. (python-shell-calculate-command-1) (python-shell-calculate-process-environment-3) (python-shell-calculate-exec-path-2, python-shell-make-comint-1) (python-shell-make-comint-2, python-shell-make-comint-4) (python-shell-get-process-1, python-util-clone-local-variables-1): Replace obsolete function and variable references with current.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el44
1 files changed, 12 insertions, 32 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 47c6a90bbde..bd8c734e0b9 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2087,36 +2087,18 @@ and `python-shell-output-prompt-regexp' using the values from
2087 2087
2088(defun python-shell-get-process-name (dedicated) 2088(defun python-shell-get-process-name (dedicated)
2089 "Calculate the appropriate process name for inferior Python process. 2089 "Calculate the appropriate process name for inferior Python process.
2090If DEDICATED is t and the variable `buffer-file-name' is non-nil 2090If DEDICATED is t returns a string with the form
2091returns a string with the form 2091`python-shell-buffer-name'[`buffer-name'] else returns the value
2092`python-shell-buffer-name'[variable `buffer-file-name'] else 2092of `python-shell-buffer-name'."
2093returns the value of `python-shell-buffer-name'." 2093 (if dedicated
2094 (let ((process-name 2094 (format "%s[%s]" python-shell-buffer-name (buffer-name))
2095 (if (and dedicated 2095 python-shell-buffer-name))
2096 buffer-file-name)
2097 (format "%s[%s]" python-shell-buffer-name buffer-file-name)
2098 (format "%s" python-shell-buffer-name))))
2099 process-name))
2100 2096
2101(defun python-shell-internal-get-process-name () 2097(defun python-shell-internal-get-process-name ()
2102 "Calculate the appropriate process name for Internal Python process. 2098 "Calculate the appropriate process name for Internal Python process.
2103The name is calculated from `python-shell-global-buffer-name' and 2099The name is calculated from `python-shell-global-buffer-name' and
2104a hash of all relevant global shell settings in order to ensure 2100the `buffer-name'."
2105uniqueness for different types of configurations." 2101 (format "%s[%s]" python-shell-internal-buffer-name (buffer-name)))
2106 (format "%s [%s]"
2107 python-shell-internal-buffer-name
2108 (md5
2109 (concat
2110 python-shell-interpreter
2111 python-shell-interpreter-args
2112 python-shell--prompt-calculated-input-regexp
2113 python-shell--prompt-calculated-output-regexp
2114 (mapconcat #'symbol-value python-shell-setup-codes "")
2115 (mapconcat #'identity python-shell-process-environment "")
2116 (mapconcat #'identity python-shell-extra-pythonpaths "")
2117 (mapconcat #'identity python-shell-exec-path "")
2118 (or python-shell-virtualenv-root "")
2119 (mapconcat #'identity python-shell-exec-path "")))))
2120 2102
2121(defun python-shell-calculate-command () 2103(defun python-shell-calculate-command ()
2122 "Calculate the string used to execute the inferior Python process." 2104 "Calculate the string used to execute the inferior Python process."
@@ -2606,12 +2588,10 @@ there for compatibility with CEDET.")
2606 2588
2607(defun python-shell-internal-get-or-create-process () 2589(defun python-shell-internal-get-or-create-process ()
2608 "Get or create an inferior Internal Python process." 2590 "Get or create an inferior Internal Python process."
2609 (let* ((proc-name (python-shell-internal-get-process-name)) 2591 (let ((proc-name (python-shell-internal-get-process-name)))
2610 (proc-buffer-name (format " *%s*" proc-name))) 2592 (if (process-live-p proc-name)
2611 (when (not (process-live-p proc-name)) 2593 (get-process proc-name)
2612 (run-python-internal) 2594 (run-python-internal))))
2613 (setq python-shell-internal-buffer proc-buffer-name))
2614 (get-buffer-process proc-buffer-name)))
2615 2595
2616(define-obsolete-function-alias 2596(define-obsolete-function-alias
2617 'python-proc 'python-shell-internal-get-or-create-process "24.3") 2597 'python-proc 'python-shell-internal-get-or-create-process "24.3")