emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Revamping bs.el


From: Juanma Barranquero
Subject: Revamping bs.el
Date: Tue, 6 Dec 2022 03:13:15 +0100


As a long-time user of bs.el, I've often been quite frustrated by some of its limitations. It shows its age here and there, but mainly in two aspects:

- It uses kludgy code to save & restore window configurations to set the frame back to a "normal" state after exiting; that code just doesn't play nice with the newer display-buffer-alist window setup.

- It doesn't use tabulated-list-mode and instead creates its own clunky "header line", sort functions, etc. One example where that goes wrong is when the current bs-configuration wants to show more than `bs-max-window-height' buffers; in this case, it is perfectly possible to just move along the list until you push the "header line" out of the window.

So I'd like to work on this on master, for the 30.1 release.

For the first problem, the attached patch makes bs-show to use pop-to-buffer, and adds a bs-default-action-list customizable option, preloaded with a value that imitates the current, non-patched behavior, while allowing setting display-buffer-alist, or the customizable option, to further adapt bs to modern practices. The code also removes one function and one variable, which I haven't obsoleted because they're intern.

Now, in my tests the behavior of bs-show has not changed (except for a tiny detail where the patched behavior is, I think, superior to the old one**). However, I'm pretty sure there will be some bugs lurking. As this is a small change, easily reverted, and for a quite non-critical piece of Emacs, I'd prefer to install the patch ASAP in master and let the bug reports come, instead of trying to develop it in a feature branch that nobody will fetch and test (and understandably so).

--------------
**The difference is that, with the old code,

emacs -Q
C-x 2
M-x bs-show <ret>

makes the bottom window grow while the *bs-selection* buffer is active because the bs window is created at half the height of the top window, and then shrunk. In my patch, I use window-combination-limit to force the top window and the new bs window to be a combination group so their combined height doesn't change. 
--------------

Now, the second problem (deriving bs-mode from tabulated-list-mode) is not as straightforward. Using the tabulated-list machinery to populate *buffer-selection*, and create the header-line on the fly, is of course easy enough. The problems come from the impedance mismatch between the extremely column-oriented sorting machinery of tabulated-list-mode, vs the freedom of bs sort functions that are not so limited. A few weeks ago I spent a couple of days looking at the issue and came to the conclusion that making bs work with tabulated-list-mode would require adding some functionality to the later, so it can better communicate with its derived mode and be aware that it has sorted the data in... "unexpected ways".

So, at this point,

1) Is there some interest (or, at the very least, indifference ;-) in my revamping bs.el to work better with display-buffer-alist?
2) If so, it's ok to install the change in master?

Once this is settled, we can discuss whether the second part of the rework is worth pursuing or not, and if so, what would be necessary.


Attachment: 0001-lisp-bs.el-Adapt-to-modern-display-buffer-alist-wind.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]