>>> explicitly instead of using an action alist `(window-height >>> . fit-window-to-buffer)'? >> >> IIUC that would mean that it couldn't be configured via >> display-buffer-alist, right? > > Obviously. Do we want to control filling via `display-buffer'? Maybe it would be a good thing to add a new action parameter to `display-buffer' that would be like the existing `quit-function' in `with-current-buffer-window', and will call its body between displaying the buffer and applying final actions alists like (window-height . fit-window-to-buffer) > Anyway, the output happens via `with-output-to-temp-buffer' which has no > direct means to pass an appropriate action to `display-buffer'. If we > used `with-temp-buffer-window' instead, we could pass an ACTION argument > to fill the buffer according to the size of the window used instead of > adjusting the window to the buffer size. In that case the configuration > could be controlled via `display-buffer-alist'. `dired-mark-pop-up' already uses `with-current-buffer-window' that is like `with-temp-buffer-window', but still has the same problem as the screenshot below demonstrates: it inserts the contents to the buffer before displaying it, so it has no way to get the final window dimensions while inserting the contents, and leaves empty columns. It's possible in `dired-mark-pop-up' to move formatting (i.e. the call to `dired-format-columns-of-files') from the BODY arg of `with-current-buffer-window' to its QUIT-FUNCTION arg, and it will fill the empty columns, because the formatting will happen after displaying the buffer. But then (window-height . fit-window-to-buffer) will be called on the empty buffer, that will always produce a small window with 3-lines height.