Subject: bug#69983: Use category for display-buffer-alist

From: Juri Linkov <[email-masked]>
Date: Thu, 04 Apr 2024 09:16:17 +0300

>> 'display-comint-buffer-action' and 'display-tex-shell-buffer-action'
>> are out of place in window.el, and they are redundant per se.
>>
>> What these variables are trying to achieve is already possible
>> to do by using a 'category' in 'display-buffer-alist'.
>>
>> Or we need to keep backward-compatibility?  Then the first step
>> to deprecate there variables would be something like this:
>
> Please proceed as carefully as possible, here might be dragons.

Ok, here is a complete patch:

diff --git a/lisp/window.el b/lisp/window.el
index 3867f6fa6ef..29e7310958b 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8923,7 +8923,8 @@ pop-to-buffer-same-window
 another window."
   (pop-to-buffer buffer display-buffer--same-window-action norecord))
 
-(defcustom display-comint-buffer-action display-buffer--same-window-action
+(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
@@ -8931,8 +8932,14 @@ display-comint-buffer-action
   :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))
+                                             (inhibit-same-window . t)
+                                             (category . tex-shell))
   "`display-buffer' action for displaying TeX shell buffers."
   :type display-buffer--action-custom-type
   :risky t
@@ -8940,6 +8947,11 @@ display-tex-shell-buffer-action
   :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.