Subject: bug#33007: 27.0.50; Proposal for function to edit and return string

From: Juri Linkov <[email-masked]>
Date: Thu, 28 Apr 2022 10:32:16 +0300

>> pop-to-buffer-same-window does allow customization via
>> display-buffer-alist, but -below-selected would be a better default.
>
> This is what could be used:
>
>   (pop-to-buffer (generate-new-buffer "*edit string*")
>                  '(display-buffer-below-selected
>                    (window-min-height . 10)
>                    (window-height . fit-window-to-buffer)))
>
> but currently its window-min-height has no effect.
> Maybe because of a bug?  The docstring of display-buffer-below-selected:
>
>   If ALIST contains a `window-min-height' entry, this function
>   ensures that the window used is or can become at least as high as
>   specified by that entry's value.  Note that such an entry alone
>   will not resize the window per se.  In order to do that, ALIST
>   must also contain a `window-height' entry with the same value.
>
> But still the window height is less than 10 lines.

Maybe a separate bug report is needed?  Because it seems that
the order of processing these parameters should be rather like this:

1. first set window-height with fit-window-to-buffer;
2. then check if the constraint of window-min-height is fulfilled,
   and shrink too high window.

Then 'string-edit' will insert the initial string, and
'fit-window-to-buffer' will fit the window.  If the window height
is less than 10 lines, it will enlarge to 10 lines.  But in case of
too many lines, the window height should not be more than
half of the original window.