Re: Position buffer contents at bottom of window
Eli Zaretskii <[email protected]> Thu, 25 Jun 2026 07:38:22 +0300
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
> From: Joost Kremers <[email protected]> > Cc: [email protected] > Date: Thu, 25 Jun 2026 00:04:39 +0200 > > On Wed, Jun 24 2026, Eli Zaretskii wrote: > >> From: Joost Kremers <[email protected]> > >> Cc: [email protected] > >> Date: Wed, 24 Jun 2026 15:40:21 +0200 > >> > >> On Wed, Jun 24 2026, Eli Zaretskii wrote: > >> > Btw, why don't you use recenter-top-bottom? > >> > >> My first idea was to use `(recenter -1)`, which works predictably, but it > >> often leaves a one-line gap between the bottom window edge and the last > >> buffer line. I'm trying to get rid of that gap. > > > > Please show the case where this gap happens. This works for me with > > buffers that have the last line end in a newline: > > > > (progn > > (goto-char (1- (point-max))) > > (recenter -1 t)) > > I'll need to see if I can come up with a minimal example, because I cannot > show the actual code, unfortunately. However, the buffer contains a series > of images, one per line, with newlines in between. The images are higher > than the frame's character height, though I don't know if that's relevant. > They also all have `:ascent` set to 100, so they sit on the base line. So the problem happens only with buffers that end in images? How tall are the images, in terms of the canonical line height? Also, if you remove the :ascent property from the image specs, does the above snippet work as desired? > The last line of the buffer has a single newline without additional text. > Placing point at `(1- (point-max))` puts it right after the last image, so > `(recenter -1)` should, IIUC, place the image right above the window > bottom, with the final empty line invisible (or at least partially > invisible). But in actual fact that line is still completely visible. I can > move the cursor to it without causing any scrolling. I feel that the details are highly dependent on the particulars of the image (its dimensions etc.) and the surrounding text. So an example would go a long way towards identifying the possible causes. Btw, why is it a problem to have a single empty line at EOB visible in your case?