From d706be4b345f3e2d242c4f2ffb5e566845b2935d Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 4 Dec 2024 09:40:33 +0200 Subject: [PATCH] Remove obsolete 'display-comint-buffer-action' (bug#74361) * lisp/window.el (display-comint-buffer-action): (display-tex-shell-buffer-action): Remove obsolete defcustoms. * lisp/cmuscheme.el (run-scheme, switch-to-scheme): * lisp/shell.el (shell): * lisp/eshell/eshell.el (eshell): * lisp/progmodes/inf-lisp.el (inferior-lisp): * lisp/progmodes/project.el (project-shell, project-eshell): * lisp/progmodes/sh-script.el (sh-show-shell): Replace 'display-comint-buffer-action' with a list of 'display-buffer--same-window-action' and '(category . comint)'. * lisp/org/ol-eshell.el (org-eshell-open): Add '(category . comint)'. * lisp/textmodes/tex-mode.el (tex-display-shell) (tex-recenter-output-buffer): Replace 'display-tex-shell-buffer-action' with a list of 'display-buffer-in-previous-window' and '(category . tex-shell)'. --- etc/NEWS | 6 ++++++ lisp/cmuscheme.el | 8 ++++---- lisp/eshell/eshell.el | 4 ++-- lisp/org/ol-eshell.el | 4 ++-- lisp/progmodes/inf-lisp.el | 4 ++-- lisp/progmodes/project.el | 6 ++++-- lisp/progmodes/sh-script.el | 5 +++-- lisp/shell.el | 4 ++-- lisp/textmodes/tex-mode.el | 10 ++++++---- lisp/window.el | 29 ----------------------------- 10 files changed, 31 insertions(+), 49 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 4a82cbc4dfaa..3efce149dbf7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -154,6 +154,12 @@ that the actual killing or burying of the buffer is done by the caller. With this option set, 'quit-restore-window' will delete its window more aggressively rather than switching to some other buffer in it. +--- +*** The user option 'display-comint-buffer-action' has been removed. +It has been obsolete since Emacs 30.1. Use '(category . comint)' instead. +Another user option 'display-tex-shell-buffer-action' has been removed too +for which you can use '(category . tex-shell)'. + ** Frames +++ diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el index d4316fb11751..b03cf1f18405 100644 --- a/lisp/cmuscheme.el +++ b/lisp/cmuscheme.el @@ -238,8 +238,8 @@ is run). (inferior-scheme-mode))) (setq scheme-program-name cmd) (setq scheme-buffer "*scheme*") - (with-suppressed-warnings ((obsolete display-comint-buffer-action)) - (pop-to-buffer "*scheme*" display-comint-buffer-action))) + (pop-to-buffer "*scheme*" (append display-buffer--same-window-action + '((category . comint))))) (defun scheme-start-file (prog) "Return the name of the start file corresponding to PROG. @@ -359,8 +359,8 @@ With argument, position cursor at end of buffer." (interactive "P") (if (or (and scheme-buffer (get-buffer scheme-buffer)) (scheme-interactively-start-process)) - (with-suppressed-warnings ((obsolete display-comint-buffer-action)) - (pop-to-buffer scheme-buffer display-comint-buffer-action)) + (pop-to-buffer scheme-buffer (append display-buffer--same-window-action + '((category . comint)))) (error "No current process buffer. See variable `scheme-buffer'")) (when eob-p (push-mark) diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index fc08734d5f35..3def918bdd15 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el @@ -278,8 +278,8 @@ information on Eshell, see Info node `(eshell)Top'." (t (get-buffer-create eshell-buffer-name))))) (cl-assert (and buf (buffer-live-p buf))) - (with-suppressed-warnings ((obsolete display-comint-buffer-action)) - (pop-to-buffer buf display-comint-buffer-action)) + (pop-to-buffer buf (append display-buffer--same-window-action + '((category . comint)))) (unless (derived-mode-p 'eshell-mode) (eshell-mode)) buf)) diff --git a/lisp/org/ol-eshell.el b/lisp/org/ol-eshell.el index 595dd0ee0f80..e364a38c17d6 100644 --- a/lisp/org/ol-eshell.el +++ b/lisp/org/ol-eshell.el @@ -51,9 +51,9 @@ followed by a colon." (if (get-buffer eshell-buffer-name) (pop-to-buffer eshell-buffer-name - (if (boundp 'display-comint-buffer-action) ; Emacs >= 29 + (if (boundp 'display-comint-buffer-action) ; Emacs >= 29, <= 30 display-comint-buffer-action - '(display-buffer-same-window (inhibit-same-window)))) + '(display-buffer-same-window (inhibit-same-window) (category . comint)))) (eshell)) (goto-char (point-max)) (eshell-kill-input) diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el index 85fc6b930f59..b092b3b679c4 100644 --- a/lisp/progmodes/inf-lisp.el +++ b/lisp/progmodes/inf-lisp.el @@ -308,8 +308,8 @@ quoted using shell quote syntax. "inferior-lisp" (car cmdlist) nil (cdr cmdlist))) (inferior-lisp-mode))) (setq inferior-lisp-buffer "*inferior-lisp*") - (with-suppressed-warnings ((obsolete display-comint-buffer-action)) - (pop-to-buffer "*inferior-lisp*" display-comint-buffer-action))) + (pop-to-buffer "*inferior-lisp*" (append display-buffer--same-window-action + '((category . comint))))) ;;;###autoload (defalias 'run-lisp 'inferior-lisp) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 33e8aab469b2..ed6be4532743 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1376,7 +1376,8 @@ if one already exists." (shell-buffer (get-buffer default-project-shell-name))) (if (and shell-buffer (not current-prefix-arg)) (if (comint-check-proc shell-buffer) - (pop-to-buffer shell-buffer (bound-and-true-p display-comint-buffer-action)) + (pop-to-buffer shell-buffer (append display-buffer--same-window-action + '((category . comint)))) (shell shell-buffer)) (shell (generate-new-buffer-name default-project-shell-name))))) @@ -1393,7 +1394,8 @@ 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 eshell-buffer (bound-and-true-p display-comint-buffer-action)) + (pop-to-buffer eshell-buffer (append display-buffer--same-window-action + '((category . comint)))) (eshell t)))) ;;;###autoload diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 3aa0f0919bcf..15ba6e6f2a08 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1447,8 +1447,9 @@ If FORCE is non-nil and no process found, create one." (defun sh-show-shell () "Pop the shell interaction buffer." (interactive) - (with-suppressed-warnings ((obsolete display-comint-buffer-action)) - (pop-to-buffer (process-buffer (sh-shell-process t)) display-comint-buffer-action))) + (pop-to-buffer (process-buffer (sh-shell-process t)) + (append display-buffer--same-window-action + '((category . comint))))) (defun sh-send-text (text) "Send TEXT to `sh-shell-process'." diff --git a/lisp/shell.el b/lisp/shell.el index 6cfae470cd78..33d80061adab 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -953,8 +953,8 @@ 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). - (with-suppressed-warnings ((obsolete display-comint-buffer-action)) - (pop-to-buffer buffer display-comint-buffer-action)) + (pop-to-buffer buffer (append display-buffer--same-window-action + '((category . comint)))) (with-connection-local-variables (when file-name diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 9cb95f59da44..06a451127190 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2092,8 +2092,9 @@ 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." - (with-suppressed-warnings ((obsolete display-tex-shell-buffer-action)) - (display-buffer (tex-shell-buf) display-tex-shell-buffer-action)) + (display-buffer (tex-shell-buf) '(display-buffer-in-previous-window + (inhibit-same-window . t) + (category . tex-shell))) (tex-recenter-output-buffer nil)) (defun tex-shell-sentinel (proc _msg) @@ -2753,8 +2754,9 @@ line LINE of the window, or centered if LINE is nil." (if (null tex-shell) (message "No TeX output buffer") (when-let* ((window - (with-suppressed-warnings ((obsolete display-tex-shell-buffer-action)) - (display-buffer tex-shell display-tex-shell-buffer-action)))) + (display-buffer tex-shell '(display-buffer-in-previous-window + (inhibit-same-window . t) + (category . tex-shell))))) (with-selected-window window (bury-buffer tex-shell) (goto-char (point-max)) diff --git a/lisp/window.el b/lisp/window.el index c790118c5e08..e9d57652ec64 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -9115,35 +9115,6 @@ currently selected window; otherwise it will be displayed in another window." (pop-to-buffer buffer display-buffer--same-window-action norecord)) -(defcustom display-comint-buffer-action - (append display-buffer--same-window-action '((category . comint))) - "`display-buffer' action for displaying comint buffers." - :type display-buffer--action-custom-type - :risky t - :version "29.1" - :group 'windows - :group 'comint) - -(make-obsolete-variable - 'display-comint-buffer-action - "use a `(category . comint)' condition in `display-buffer-alist'." - "30.1") - -(defcustom display-tex-shell-buffer-action '(display-buffer-in-previous-window - (inhibit-same-window . t) - (category . tex-shell)) - "`display-buffer' action for displaying TeX shell buffers." - :type display-buffer--action-custom-type - :risky t - :version "29.1" - :group 'windows - :group 'tex-run) - -(make-obsolete-variable - 'display-tex-shell-buffer-action - "use a `(category . tex-shell)' condition in `display-buffer-alist'." - "30.1") - (defun read-buffer-to-switch (prompt) "Read the name of a buffer to switch to, prompting with PROMPT. Return the name of the buffer as a string.