unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69983: Use category for display-buffer-alist
@ 2024-03-24 17:19 Juri Linkov
  2024-03-25  9:41 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 52+ messages in thread
From: Juri Linkov @ 2024-03-24 17:19 UTC (permalink / raw)
  To: 69983; +Cc: martin rudalics

'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'.
Here is an already supported example:

#+begin_src emacs-lisp
(add-to-list 'display-buffer-alist
             `(,(lambda (_buffer-name action)
                  (eq (alist-get 'category action) 'comint))
               (display-buffer-in-direction)
	       (direction . top)))

(display-buffer (get-buffer-create "blablabla")
		'(nil (category . comint)))
#+end_src

The advantage of this approach is removing a need
of writing a complex regexp to match the buffer name.

Using this approach it's possible just to mark
all related callers with the same category, e.g.:

diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el
index c84a1809322..ccd7f2f713f 100644
--- a/lisp/cmuscheme.el
+++ b/lisp/cmuscheme.el
@@ -238,7 +238,7 @@ run-scheme
 	(inferior-scheme-mode)))
   (setq scheme-program-name cmd)
   (setq scheme-buffer "*scheme*")
-  (pop-to-buffer "*scheme*" display-comint-buffer-action))
+  (pop-to-buffer "*scheme*" '(nil (category . comint))))

diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 141bd18cf1e..1aa3bbd4239 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -308,7 +308,7 @@ inferior-lisp
 			   "inferior-lisp" (car cmdlist) nil (cdr cmdlist)))
 	(inferior-lisp-mode)))
   (setq inferior-lisp-buffer "*inferior-lisp*")
-  (pop-to-buffer "*inferior-lisp*" display-comint-buffer-action))
+  (pop-to-buffer "*inferior-lisp*" '(nil (category . comint))))

Or we need to keep backward-compatibility?  Then the first step
to deprecate there variables would be something like this:

diff --git a/lisp/window.el b/lisp/window.el
index bea050e181c..fa417817d1d 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8912,7 +8944,7 @@ 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





^ permalink raw reply related	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2024-04-24 16:46 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-24 17:19 bug#69983: Use category for display-buffer-alist Juri Linkov
2024-03-25  9:41 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-25 17:12   ` Juri Linkov
2024-03-26  9:55     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-27  7:15       ` Juri Linkov
2024-03-28  7:47         ` Juri Linkov
2024-03-28  8:23           ` Eli Zaretskii
2024-03-28 17:46             ` Juri Linkov
2024-03-28  9:18           ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-28 17:50             ` Juri Linkov
2024-03-29  8:43               ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-29 16:30                 ` Juri Linkov
2024-03-30  9:36                   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-30 18:22                     ` Juri Linkov
2024-04-02 16:52                       ` Juri Linkov
2024-04-04  6:16   ` Juri Linkov
2024-04-05 16:47     ` Juri Linkov
2024-04-06 18:42       ` Juri Linkov
2024-04-07  8:22         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-09  6:30           ` Juri Linkov
2024-04-09  7:09             ` Eli Zaretskii
2024-04-09 16:34               ` Juri Linkov
2024-04-09 18:28                 ` Eli Zaretskii
2024-04-10  6:45                   ` Juri Linkov
2024-04-10  8:47                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-10 11:07                     ` Eli Zaretskii
2024-04-10 17:49                       ` Juri Linkov
2024-04-10 18:13                         ` Eli Zaretskii
2024-04-11  6:31                           ` Juri Linkov
2024-04-11  7:40                             ` Eli Zaretskii
2024-04-12  6:37                               ` Juri Linkov
2024-04-12  7:05                                 ` Eli Zaretskii
2024-04-12 16:50                                   ` Juri Linkov
2024-04-12 18:27                                     ` Eli Zaretskii
2024-04-13 18:49                                       ` Juri Linkov
2024-04-13 19:03                                         ` Eli Zaretskii
2024-04-14 16:04                                           ` Juri Linkov
2024-04-18 14:30                                             ` Eli Zaretskii
2024-04-18 17:16                                               ` Juri Linkov
2024-04-18 17:56                                                 ` Eli Zaretskii
2024-04-19  6:24                                                   ` Juri Linkov
2024-04-19  6:28                                                     ` Juri Linkov
2024-04-19  7:19                                                       ` Eli Zaretskii
2024-04-19 16:17                                                       ` Juri Linkov
2024-04-20 12:08                                                         ` Eli Zaretskii
2024-04-21  6:52                                                           ` Juri Linkov
2024-04-21  9:13                                                             ` Eli Zaretskii
2024-04-22  6:50                                                               ` Juri Linkov
2024-04-19  7:19                                                     ` Eli Zaretskii
2024-04-11  9:16                       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-11 11:03                         ` Eli Zaretskii
2024-04-24 16:46     ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).