GNU bug report logs - #38181
Actual height of mode-line not taken into account

Previous Next

Package: emacs;

Reported by: Jonas Bernoulli <jonas <at> bernoul.li>

Date: Tue, 12 Nov 2019 16:54:01 UTC

Severity: normal

Fixed in version 29.1

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


Message #59 received at 38181 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Jonas Bernoulli <jonas <at> bernoul.li>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 38181 <at> debbugs.gnu.org
Subject: Re: bug#38181: Actual height of mode-line not taken into account
Date: Sat, 16 Nov 2019 20:30:11 +0100
> Again, the mode-line-prettifiers are not the ones who create new buffers
> and then call fit-buffer-to-window.  It's arbitrary other packages that
> do that.  An optional argument therefore would not help because when one
> of the prettifier modes is active, then each and every third-party
> caller of fit-buffer-to-window would have to pass that optional
> argument.

I see.  Maybe a function 'set-default-mode-line-format' would be
useful here.  Anyway: At the time you prettify a mode line or show a
new buffer in a window with a to be prettified mode line, would doing
an immediate redisplay work around future problems?

> This is the advice I currently use:
>
> (defvar-local moody--size-hacked-p nil)
>
> (defun moody-redisplay (&optional _force &rest _ignored)
>    (unless moody--size-hacked-p
>      (setq moody--size-hacked-p t)
>      (redisplay t)))
>
> (advice-add 'fit-window-to-buffer :before #'moody-redisplay)
>
> Of course fit-buffer-to-window itself could be changed to do that and it
> could also be taught to only do so iff the user opted in to doing it.

If we don't want 'fit-window-to-buffer' to do that always we'd need
some variable, either buffer local or even a window parameter, that
'fit-window-to-buffer' would inspect once and reset immediately in
order to perform only the redisplay call that's really needed.

> Creating and displaying a new buffer and creating and resizing a new
> window surely *already* causes a "redisplay" without the programmer
> having to explicitly call `redisplay'.  So if we explicitly tell
> fit-window-to-buffer to redisplay, then that means that we are
> redisplaying twice, right?

I think so.  Maybe 'fit-window-to-buffer' could use the string
returned by 'format-mode-line' instead and calculate its height
without redisplaying anything.

martin




This bug report was last modified 3 years and 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.