Subject: bug#46238: 27.1; recenter-top-bottom in fullscreen

From: martin rudalics <[email-masked]>
Date: Tue, 2 Feb 2021 09:42:28 +0100

> When in fullscreen mode, recenter-top-bottom fails to toggle to the
 > "bottom" position. Pressing C-l with the cursor at the top will recenter
 > the window with the cursor in the middle, pressing it again does
 > nothing, and pressing it one more time will recenter the window with the
 > cursor at the top. The quirk is not present when emacs is not in
 > fullscreen mode.
 >
 >
 > In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0)
 >   of 2020-11-07, modified by Debian built on x86-ubc-01
 > Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
 > System Description: Debian GNU/Linux bullseye/sid

Thanks for the report.  I tried to reproduce this with emacs -Q, F11 and
a sufficiently large .el buffer using a GTK3 build for Debian 10 but
failed.  After a third invocation, 'recenter-top-bottom' moves point to
a position somewhere at the bottom of the window.  Is that the idea of
the function (I never used it before) or should it do something else?

Reading it for the first time, 'recenter-top-bottom' has an incredibly
misleading doc-string: For me "Move current buffer line to the specified
window line" means to (1) remove the buffer line at point from its
buffer and (2) reinsert it at the window line specified by ARG but I
doubt that that's the intended behavior.  Maybe someone more
knowledgeable could make it more reasonable, maybe stealing text like
"positions the current line at the top of the window" from 'recenter'.

In either case, please try to reproduce the behavior you see with emacs
-Q and maybe some trivial buffer (whose contents you could also post
here).  Then please edebug 'recenter-top-bottom' and try to find out
where it fails in comparison with say a maximized or normal window.  In
particular we'd have to know the value of 'recenter-last-op' in the
invocation where it fails.  Then you could try to feed the failing
argument into 'recenter' itself and look whether it fails there as well.

Thanks, martin