diff options
| author | Sam Steingold | 2021-12-28 17:27:41 -0500 |
|---|---|---|
| committer | Sam Steingold | 2021-12-28 17:28:49 -0500 |
| commit | 18b680cfd177e877991be2bd70ead628bbdc0aa0 (patch) | |
| tree | 0d926a816f1a60e5836221192549854155740b33 | |
| parent | 6e52becfbe2a33c025b8c4838b3c8f06ba5a6fb8 (diff) | |
| download | emacs-18b680cfd177e877991be2bd70ead628bbdc0aa0.tar.gz emacs-18b680cfd177e877991be2bd70ead628bbdc0aa0.zip | |
Fix bug#52467 by adding a new custom variable 'display-comint-buffer-action'
* lisp/window.el (display-comint-buffer-action): New `defcustom`,
defaults to 'display-buffer-same-window' for backward compatibility.
* lisp/cmuscheme.el (run-scheme, switch-to-scheme): Pass
'display-comint-buffer-action' to 'pop-to-buffer' instead
of using 'pop-to-buffer-same-window'.
* lisp/eshell/eshell.el (eshell): Likewise.
* lisp/shell.el (shell): Likewise.
* lisp/org/ol-eshell.el (org-eshell-open): Likewise.
* lisp/progmodes/inf-lisp.el (inferior-lisp): Likewise.
* lisp/progmodes/project.el (project-shell, project-eshell): Likewise.
* lisp/textmodes/tex-mode.el (tex-display-shell, tex-compile-default)
(tex-recenter-output-buffer): Pass 'display-comint-buffer-action'
to 'pop-to-buffer'.
| -rw-r--r-- | lisp/cmuscheme.el | 4 | ||||
| -rw-r--r-- | lisp/eshell/eshell.el | 2 | ||||
| -rw-r--r-- | lisp/org/ol-eshell.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/inf-lisp.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/project.el | 4 | ||||
| -rw-r--r-- | lisp/shell.el | 2 | ||||
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 6 | ||||
| -rw-r--r-- | lisp/window.el | 8 |
8 files changed, 19 insertions, 11 deletions
diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el index 47113ad8c2e..acc08889076 100644 --- a/lisp/cmuscheme.el +++ b/lisp/cmuscheme.el | |||
| @@ -237,7 +237,7 @@ is run). | |||
| 237 | (inferior-scheme-mode))) | 237 | (inferior-scheme-mode))) |
| 238 | (setq scheme-program-name cmd) | 238 | (setq scheme-program-name cmd) |
| 239 | (setq scheme-buffer "*scheme*") | 239 | (setq scheme-buffer "*scheme*") |
| 240 | (pop-to-buffer-same-window "*scheme*")) | 240 | (pop-to-buffer "*scheme*" display-comint-buffer-action)) |
| 241 | 241 | ||
| 242 | (defun scheme-start-file (prog) | 242 | (defun scheme-start-file (prog) |
| 243 | "Return the name of the start file corresponding to PROG. | 243 | "Return the name of the start file corresponding to PROG. |
| @@ -357,7 +357,7 @@ With argument, position cursor at end of buffer." | |||
| 357 | (interactive "P") | 357 | (interactive "P") |
| 358 | (if (or (and scheme-buffer (get-buffer scheme-buffer)) | 358 | (if (or (and scheme-buffer (get-buffer scheme-buffer)) |
| 359 | (scheme-interactively-start-process)) | 359 | (scheme-interactively-start-process)) |
| 360 | (pop-to-buffer-same-window scheme-buffer) | 360 | (pop-to-buffer scheme-buffer display-comint-buffer-action) |
| 361 | (error "No current process buffer. See variable `scheme-buffer'")) | 361 | (error "No current process buffer. See variable `scheme-buffer'")) |
| 362 | (when eob-p | 362 | (when eob-p |
| 363 | (push-mark) | 363 | (push-mark) |
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index c66ad000722..47fdfa095fc 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el | |||
| @@ -260,7 +260,7 @@ information on Eshell, see Info node `(eshell)Top'." | |||
| 260 | (t | 260 | (t |
| 261 | (get-buffer-create eshell-buffer-name))))) | 261 | (get-buffer-create eshell-buffer-name))))) |
| 262 | (cl-assert (and buf (buffer-live-p buf))) | 262 | (cl-assert (and buf (buffer-live-p buf))) |
| 263 | (pop-to-buffer-same-window buf) | 263 | (pop-to-buffer buf display-comint-buffer-action) |
| 264 | (unless (derived-mode-p 'eshell-mode) | 264 | (unless (derived-mode-p 'eshell-mode) |
| 265 | (eshell-mode)) | 265 | (eshell-mode)) |
| 266 | buf)) | 266 | buf)) |
diff --git a/lisp/org/ol-eshell.el b/lisp/org/ol-eshell.el index a7550e3769b..b13f659b22d 100644 --- a/lisp/org/ol-eshell.el +++ b/lisp/org/ol-eshell.el | |||
| @@ -46,7 +46,7 @@ followed by a colon." | |||
| 46 | (eshell-buffer-name (car buffer-and-command)) | 46 | (eshell-buffer-name (car buffer-and-command)) |
| 47 | (command (cadr buffer-and-command))) | 47 | (command (cadr buffer-and-command))) |
| 48 | (if (get-buffer eshell-buffer-name) | 48 | (if (get-buffer eshell-buffer-name) |
| 49 | (pop-to-buffer-same-window eshell-buffer-name) | 49 | (pop-to-buffer eshell-buffer-name display-comint-buffer-action) |
| 50 | (eshell)) | 50 | (eshell)) |
| 51 | (goto-char (point-max)) | 51 | (goto-char (point-max)) |
| 52 | (eshell-kill-input) | 52 | (eshell-kill-input) |
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el index e69a9ff394e..2d2061e7cfe 100644 --- a/lisp/progmodes/inf-lisp.el +++ b/lisp/progmodes/inf-lisp.el | |||
| @@ -308,7 +308,7 @@ quoted using shell quote syntax. | |||
| 308 | "inferior-lisp" (car cmdlist) nil (cdr cmdlist))) | 308 | "inferior-lisp" (car cmdlist) nil (cdr cmdlist))) |
| 309 | (inferior-lisp-mode))) | 309 | (inferior-lisp-mode))) |
| 310 | (setq inferior-lisp-buffer "*inferior-lisp*") | 310 | (setq inferior-lisp-buffer "*inferior-lisp*") |
| 311 | (pop-to-buffer-same-window "*inferior-lisp*")) | 311 | (pop-to-buffer "*inferior-lisp*" display-comint-buffer-action)) |
| 312 | 312 | ||
| 313 | ;;;###autoload | 313 | ;;;###autoload |
| 314 | (defalias 'run-lisp 'inferior-lisp) | 314 | (defalias 'run-lisp 'inferior-lisp) |
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 3b634471ace..62dba7b3933 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -1015,7 +1015,7 @@ if one already exists." | |||
| 1015 | (default-project-shell-name (project-prefixed-buffer-name "shell")) | 1015 | (default-project-shell-name (project-prefixed-buffer-name "shell")) |
| 1016 | (shell-buffer (get-buffer default-project-shell-name))) | 1016 | (shell-buffer (get-buffer default-project-shell-name))) |
| 1017 | (if (and shell-buffer (not current-prefix-arg)) | 1017 | (if (and shell-buffer (not current-prefix-arg)) |
| 1018 | (pop-to-buffer-same-window shell-buffer) | 1018 | (pop-to-buffer shell-buffer display-comint-buffer-action) |
| 1019 | (shell (generate-new-buffer-name default-project-shell-name))))) | 1019 | (shell (generate-new-buffer-name default-project-shell-name))))) |
| 1020 | 1020 | ||
| 1021 | ;;;###autoload | 1021 | ;;;###autoload |
| @@ -1031,7 +1031,7 @@ if one already exists." | |||
| 1031 | (eshell-buffer-name (project-prefixed-buffer-name "eshell")) | 1031 | (eshell-buffer-name (project-prefixed-buffer-name "eshell")) |
| 1032 | (eshell-buffer (get-buffer eshell-buffer-name))) | 1032 | (eshell-buffer (get-buffer eshell-buffer-name))) |
| 1033 | (if (and eshell-buffer (not current-prefix-arg)) | 1033 | (if (and eshell-buffer (not current-prefix-arg)) |
| 1034 | (pop-to-buffer-same-window eshell-buffer) | 1034 | (pop-to-buffer eshell-buffer display-comint-buffer-action) |
| 1035 | (eshell t)))) | 1035 | (eshell t)))) |
| 1036 | 1036 | ||
| 1037 | ;;;###autoload | 1037 | ;;;###autoload |
diff --git a/lisp/shell.el b/lisp/shell.el index 370532ea46f..1860e4691d3 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -758,7 +758,7 @@ Make the shell buffer the current buffer, and return it. | |||
| 758 | (current-buffer))) | 758 | (current-buffer))) |
| 759 | ;; The buffer's window must be correctly set when we call comint | 759 | ;; The buffer's window must be correctly set when we call comint |
| 760 | ;; (so that comint sets the COLUMNS env var properly). | 760 | ;; (so that comint sets the COLUMNS env var properly). |
| 761 | (pop-to-buffer-same-window buffer) | 761 | (pop-to-buffer buffer) |
| 762 | 762 | ||
| 763 | (with-connection-local-variables | 763 | (with-connection-local-variables |
| 764 | ;; On remote hosts, the local `shell-file-name' might be useless. | 764 | ;; On remote hosts, the local `shell-file-name' might be useless. |
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 5fba93c76eb..0c112b2ecf5 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -2037,7 +2037,7 @@ In the tex shell buffer this command behaves like `comint-send-input'." | |||
| 2037 | 2037 | ||
| 2038 | (defun tex-display-shell () | 2038 | (defun tex-display-shell () |
| 2039 | "Make the TeX shell buffer visible in a window." | 2039 | "Make the TeX shell buffer visible in a window." |
| 2040 | (display-buffer (tex-shell-buf)) | 2040 | (display-buffer (tex-shell-buf) display-comint-buffer-action) |
| 2041 | (tex-recenter-output-buffer nil)) | 2041 | (tex-recenter-output-buffer nil)) |
| 2042 | 2042 | ||
| 2043 | (defun tex-shell-sentinel (proc _msg) | 2043 | (defun tex-shell-sentinel (proc _msg) |
| @@ -2441,7 +2441,7 @@ Only applies the FSPEC to the args part of FORMAT." | |||
| 2441 | (if cmds (tex-format-cmd (caar cmds) fspec)))))) | 2441 | (if cmds (tex-format-cmd (caar cmds) fspec)))))) |
| 2442 | 2442 | ||
| 2443 | (defun tex-cmd-doc-view (file) | 2443 | (defun tex-cmd-doc-view (file) |
| 2444 | (pop-to-buffer (find-file-noselect file))) | 2444 | (pop-to-buffer (find-file-noselect file) display-comint-buffer-action)) |
| 2445 | 2445 | ||
| 2446 | (defun tex-compile (dir cmd) | 2446 | (defun tex-compile (dir cmd) |
| 2447 | "Run a command CMD on current TeX buffer's file in DIR." | 2447 | "Run a command CMD on current TeX buffer's file in DIR." |
| @@ -2698,7 +2698,7 @@ line LINE of the window, or centered if LINE is nil." | |||
| 2698 | (window)) | 2698 | (window)) |
| 2699 | (if (null tex-shell) | 2699 | (if (null tex-shell) |
| 2700 | (message "No TeX output buffer") | 2700 | (message "No TeX output buffer") |
| 2701 | (setq window (display-buffer tex-shell)) | 2701 | (setq window (display-buffer tex-shell display-comint-buffer-action)) |
| 2702 | (with-selected-window window | 2702 | (with-selected-window window |
| 2703 | (bury-buffer tex-shell) | 2703 | (bury-buffer tex-shell) |
| 2704 | (goto-char (point-max)) | 2704 | (goto-char (point-max)) |
diff --git a/lisp/window.el b/lisp/window.el index aff99d36c59..d75dd9931bd 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -7474,6 +7474,14 @@ ALIST. See `display-buffer' for details." | |||
| 7474 | :version "24.1" | 7474 | :version "24.1" |
| 7475 | :group 'windows) | 7475 | :group 'windows) |
| 7476 | 7476 | ||
| 7477 | (defcustom display-comint-buffer-action 'display-buffer-same-window | ||
| 7478 | "The action to display a comint buffer." | ||
| 7479 | :type 'display-buffer--action-function-custom-type | ||
| 7480 | :risky t | ||
| 7481 | :version "29.1" | ||
| 7482 | :group 'windows | ||
| 7483 | :group 'comint) | ||
| 7484 | |||
| 7477 | (defconst display-buffer-fallback-action | 7485 | (defconst display-buffer-fallback-action |
| 7478 | '((display-buffer--maybe-same-window ;FIXME: why isn't this redundant? | 7486 | '((display-buffer--maybe-same-window ;FIXME: why isn't this redundant? |
| 7479 | display-buffer-reuse-window | 7487 | display-buffer-reuse-window |