diff options
| author | kobarity | 2026-01-31 23:10:03 +0900 |
|---|---|---|
| committer | Eli Zaretskii | 2026-02-07 14:41:10 +0200 |
| commit | 3d7e78b810b11b71b95a87ffabf2995dd8fe2fe9 (patch) | |
| tree | 1dea6bfe403b34e573fc0e122ba82f27ef6c2a85 /lisp/progmodes/python.el | |
| parent | 419ac8148f1fffd7755f3545137a0321914441d9 (diff) | |
| download | emacs-3d7e78b810b11b71b95a87ffabf2995dd8fe2fe9.tar.gz emacs-3d7e78b810b11b71b95a87ffabf2995dd8fe2fe9.zip | |
Revert "Performance improvement of 'python-shell-get-process'"
This reverts commit 83b4f1ba26844c178e57ecb93ea8db36e8e6fa89.
We concluded that it is better to use 'project-name-cached'.
(Bug#80045)
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index b6981c9156c..9fa2b1aaf19 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -3816,16 +3816,6 @@ variable. | |||
| 3816 | (compilation-shell-minor-mode 1) | 3816 | (compilation-shell-minor-mode 1) |
| 3817 | (python-pdbtrack-setup-tracking)) | 3817 | (python-pdbtrack-setup-tracking)) |
| 3818 | 3818 | ||
| 3819 | (defvar-local python-shell--process-cache) | ||
| 3820 | (defvar-local python-shell--process-cache-valid) | ||
| 3821 | |||
| 3822 | (defun python-shell--invalidate-process-cache () | ||
| 3823 | "Invalidate process cache." | ||
| 3824 | (dolist (buffer (buffer-list)) | ||
| 3825 | (with-current-buffer buffer | ||
| 3826 | (setq python-shell--process-cache nil | ||
| 3827 | python-shell--process-cache-valid nil)))) | ||
| 3828 | |||
| 3829 | (defun python-shell-make-comint (cmd proc-name &optional show internal) | 3819 | (defun python-shell-make-comint (cmd proc-name &optional show internal) |
| 3830 | "Create a Python shell comint buffer. | 3820 | "Create a Python shell comint buffer. |
| 3831 | CMD is the Python command to be executed and PROC-NAME is the | 3821 | CMD is the Python command to be executed and PROC-NAME is the |
| @@ -3842,7 +3832,6 @@ killed." | |||
| 3842 | (let* ((proc-buffer-name | 3832 | (let* ((proc-buffer-name |
| 3843 | (format (if (not internal) "*%s*" " *%s*") proc-name))) | 3833 | (format (if (not internal) "*%s*" " *%s*") proc-name))) |
| 3844 | (when (not (comint-check-proc proc-buffer-name)) | 3834 | (when (not (comint-check-proc proc-buffer-name)) |
| 3845 | (python-shell--invalidate-process-cache) | ||
| 3846 | (let* ((cmdlist (split-string-and-unquote cmd)) | 3835 | (let* ((cmdlist (split-string-and-unquote cmd)) |
| 3847 | (interpreter (car cmdlist)) | 3836 | (interpreter (car cmdlist)) |
| 3848 | (args (cdr cmdlist)) | 3837 | (args (cdr cmdlist)) |
| @@ -3966,15 +3955,7 @@ If current buffer is in `inferior-python-mode', return it." | |||
| 3966 | 3955 | ||
| 3967 | (defun python-shell-get-process () | 3956 | (defun python-shell-get-process () |
| 3968 | "Return inferior Python process for current buffer." | 3957 | "Return inferior Python process for current buffer." |
| 3969 | (unless (and python-shell--process-cache-valid | 3958 | (get-buffer-process (python-shell-get-buffer))) |
| 3970 | (or (not python-shell--process-cache) | ||
| 3971 | (and (process-live-p python-shell--process-cache) | ||
| 3972 | (buffer-live-p | ||
| 3973 | (process-buffer python-shell--process-cache))))) | ||
| 3974 | (setq python-shell--process-cache | ||
| 3975 | (get-buffer-process (python-shell-get-buffer)) | ||
| 3976 | python-shell--process-cache-valid t)) | ||
| 3977 | python-shell--process-cache) | ||
| 3978 | 3959 | ||
| 3979 | (defun python-shell-get-process-or-error (&optional interactivep) | 3960 | (defun python-shell-get-process-or-error (&optional interactivep) |
| 3980 | "Return inferior Python process for current buffer or signal error. | 3961 | "Return inferior Python process for current buffer or signal error. |