]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug#52467 by adding a new custom variable 'display-comint-buffer-action'
authorSam Steingold <sdsg@amazon.com>
Tue, 28 Dec 2021 22:27:41 +0000 (17:27 -0500)
committerSam Steingold <sdsg@amazon.com>
Tue, 28 Dec 2021 22:28:49 +0000 (17:28 -0500)
* 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'.

lisp/cmuscheme.el
lisp/eshell/eshell.el
lisp/org/ol-eshell.el
lisp/progmodes/inf-lisp.el
lisp/progmodes/project.el
lisp/shell.el
lisp/textmodes/tex-mode.el
lisp/window.el

index 47113ad8c2e5fb354e6752a6cbb555186f9c6e23..acc0888907679e9aee8add391129870ba128cf3e 100644 (file)
@@ -237,7 +237,7 @@ is run).
        (inferior-scheme-mode)))
   (setq scheme-program-name cmd)
   (setq scheme-buffer "*scheme*")
-  (pop-to-buffer-same-window "*scheme*"))
+  (pop-to-buffer "*scheme*" display-comint-buffer-action))
 
 (defun scheme-start-file (prog)
   "Return the name of the start file corresponding to PROG.
@@ -357,7 +357,7 @@ With argument, position cursor at end of buffer."
   (interactive "P")
   (if (or (and scheme-buffer (get-buffer scheme-buffer))
           (scheme-interactively-start-process))
-      (pop-to-buffer-same-window scheme-buffer)
+      (pop-to-buffer scheme-buffer display-comint-buffer-action)
     (error "No current process buffer.  See variable `scheme-buffer'"))
   (when eob-p
     (push-mark)
index c66ad0007221cb441a7c0aa32f3dd7c74f8618b1..47fdfa095fc9aa3ed879da9ece8f0a9fe363ed8e 100644 (file)
@@ -260,7 +260,7 @@ information on Eshell, see Info node `(eshell)Top'."
                   (t
                    (get-buffer-create eshell-buffer-name)))))
     (cl-assert (and buf (buffer-live-p buf)))
-    (pop-to-buffer-same-window buf)
+    (pop-to-buffer buf display-comint-buffer-action)
     (unless (derived-mode-p 'eshell-mode)
       (eshell-mode))
     buf))
index a7550e3769bddc941b3b0c18fdc92273c51eb778..b13f659b22dc1ffcd55e82994a92084d1ec5b723 100644 (file)
@@ -46,7 +46,7 @@ followed by a colon."
          (eshell-buffer-name (car buffer-and-command))
          (command (cadr buffer-and-command)))
     (if (get-buffer eshell-buffer-name)
-       (pop-to-buffer-same-window eshell-buffer-name)
+       (pop-to-buffer eshell-buffer-name display-comint-buffer-action)
       (eshell))
     (goto-char (point-max))
     (eshell-kill-input)
index e69a9ff394ef877e05cc013055d3e0fa041a05ed..2d2061e7cfe44f5a8f206ac77b185a7ed6ab47ff 100644 (file)
@@ -308,7 +308,7 @@ quoted using shell quote syntax.
                           "inferior-lisp" (car cmdlist) nil (cdr cmdlist)))
        (inferior-lisp-mode)))
   (setq inferior-lisp-buffer "*inferior-lisp*")
-  (pop-to-buffer-same-window "*inferior-lisp*"))
+  (pop-to-buffer "*inferior-lisp*" display-comint-buffer-action))
 
 ;;;###autoload
 (defalias 'run-lisp 'inferior-lisp)
index 3b634471ace25243e414f764e0eefe1c1ba348f5..62dba7b39337334e5d174eb93cdace7d20c47072 100644 (file)
@@ -1015,7 +1015,7 @@ if one already exists."
          (default-project-shell-name (project-prefixed-buffer-name "shell"))
          (shell-buffer (get-buffer default-project-shell-name)))
     (if (and shell-buffer (not current-prefix-arg))
-        (pop-to-buffer-same-window shell-buffer)
+        (pop-to-buffer shell-buffer display-comint-buffer-action)
       (shell (generate-new-buffer-name default-project-shell-name)))))
 
 ;;;###autoload
@@ -1031,7 +1031,7 @@ if one already exists."
          (eshell-buffer-name (project-prefixed-buffer-name "eshell"))
          (eshell-buffer (get-buffer eshell-buffer-name)))
     (if (and eshell-buffer (not current-prefix-arg))
-        (pop-to-buffer-same-window eshell-buffer)
+        (pop-to-buffer eshell-buffer display-comint-buffer-action)
       (eshell t))))
 
 ;;;###autoload
index 370532ea46f279a8a8512707c1ff3bd505c75c73..1860e4691d3ef6423335952a6547df2d56dc5c14 100644 (file)
@@ -758,7 +758,7 @@ Make the shell buffer the current buffer, and return it.
                  (current-buffer)))
   ;; The buffer's window must be correctly set when we call comint
   ;; (so that comint sets the COLUMNS env var properly).
-  (pop-to-buffer-same-window buffer)
+  (pop-to-buffer buffer)
 
   (with-connection-local-variables
    ;; On remote hosts, the local `shell-file-name' might be useless.
index 5fba93c76eb75424631f756bb78a5003caad1005..0c112b2ecf5744c840e6fabd5b43994d22e58a0a 100644 (file)
@@ -2037,7 +2037,7 @@ In the tex shell buffer this command behaves like `comint-send-input'."
 
 (defun tex-display-shell ()
   "Make the TeX shell buffer visible in a window."
-  (display-buffer (tex-shell-buf))
+  (display-buffer (tex-shell-buf) display-comint-buffer-action)
   (tex-recenter-output-buffer nil))
 
 (defun tex-shell-sentinel (proc _msg)
@@ -2441,7 +2441,7 @@ Only applies the FSPEC to the args part of FORMAT."
        (if cmds (tex-format-cmd (caar cmds) fspec))))))
 
 (defun tex-cmd-doc-view (file)
-  (pop-to-buffer (find-file-noselect file)))
+  (pop-to-buffer (find-file-noselect file) display-comint-buffer-action))
 
 (defun tex-compile (dir cmd)
   "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."
        (window))
     (if (null tex-shell)
        (message "No TeX output buffer")
-      (setq window (display-buffer tex-shell))
+      (setq window (display-buffer tex-shell display-comint-buffer-action))
       (with-selected-window window
        (bury-buffer tex-shell)
        (goto-char (point-max))
index aff99d36c5904a37a43aac51f38e34685a0ece59..d75dd9931bd4a2381ead0012eac3ab1b94788787 100644 (file)
@@ -7474,6 +7474,14 @@ ALIST.  See `display-buffer' for details."
   :version "24.1"
   :group 'windows)
 
+(defcustom display-comint-buffer-action 'display-buffer-same-window
+  "The action to display a comint buffer."
+  :type 'display-buffer--action-function-custom-type
+  :risky t
+  :version "29.1"
+  :group 'windows
+  :group 'comint)
+
 (defconst display-buffer-fallback-action
   '((display-buffer--maybe-same-window  ;FIXME: why isn't this redundant?
      display-buffer-reuse-window