Subject: 28.0.50; auto-resize-tool-bars / auto-resize-tab-bars grow-only

From: martin rudalics <[email-masked]>
Date: Fri, 29 Jan 2021 19:12:02 +0100

With emacs -Q run a graphical build with a tab bar or an internal tool
bar (motif, lucid, no toolkit have the latter).  Do

(setq auto-resize-tab-bars 'grow-only)

and/or

(setq auto-resize-tool-bars 'grow-only)

Now make the frame very narrow so the tool and/or tab bar wrap(s)
around.  Expand the frame again, so the items on the bar(s) occupy one
line only.  You will see empty lines below the lines showing the items.

According to the doc-strings of the above options and the Elisp manual
you should now be able to use 'recenter' to get rid of these empty
lines:

   If value is ‘grow-only’, the tab-bar’s height is only increased
   automatically; to decrease the tab-bar height, use M-x recenter.

However, this doesn't work by default since in the following part of
'recenter'

       if (!NILP (redisplay)
	  && !NILP (Vrecenter_redisplay)
	  && (!EQ (Vrecenter_redisplay, Qtty)
	      || !NILP (Ftty_type (selected_frame))))
	{
	  ptrdiff_t i;

	  /* Invalidate pixel data calculated for all compositions.  */
	  for (i = 0; i < n_compositions; i++)
	    composition_table[i]->font = NULL;
#if defined (HAVE_WINDOW_SYSTEM)
	  WINDOW_XFRAME (w)->minimize_tab_bar_window_p = 1;
#endif
#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
	  WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1;
#endif
	  Fredraw_frame (WINDOW_FRAME (w));
	  SET_FRAME_GARBAGED (WINDOW_XFRAME (w));

Vrecenter_redisplay is by default 'tty' and Ftty_type (selected_frame)
is nil, so the conjunct never becomes true and minimize_tab_bar_window_p
is never set to 1.

So we'd have to mention in the docs of this option that one can regain
these lines only by setting 'recenter-redisplay' to anything but the
default.  Better IMHO would be to abolish the never used and completely
useless 'grow-only' value for these options.

martin