>> It seems better to handle the temp-buffer setup in the buffer display action >> functions (currently there are two such functions that handle temp-buffer: >> 'display-buffer--maybe-at-bottom' and 'display-buffer-in-direction'), >> if this will help to get rid of monstrous macro 'with-displayed-buffer-window'. > > Then go for it. Here is the first step, this patch seems to keep the original behavior, but I need your help to finish it. Could you confirm that calls of window-preserve-size at the end of with-displayed-buffer-window are not needed anymore after this patch is applied, because there are the same calls of window-preserve-size at the end of window--display-buffer that are called later after buffer contents is filled by after-display-function in the middle of window--display-buffer: