Re: Position buffer contents at bottom of window
Joost Kremers <[email protected]> Wed, 24 Jun 2026 23:23:07 +0200
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 24 2026, Michael Heerdegen via Users list for the GNU Emacs text editor wrote: > Joost Kremers <[email protected]> writes: > >> ``` >> (defun my--recenter-window-to-bottom (&optional window) >> "Align contents of BUFFER to the bottom of WINDOW." >> (interactive (list (selected-window))) >> (when (window-live-p window) >> (with-current-buffer (window-buffer window) >> (when-let* ((_ (>= (window-end window t) (point-max))) >> (edges (window-body-pixel-edges window)) >> (window-top (nth 1 edges)) >> (window-bottom (nth 3 edges)) >> (text-height (cdr (window-text-pixel-size window (window-start window)))) >> (dy (- window-bottom window-top text-height))) >> (message "↑%d ↓%d ↕%d dy%d" window-top window-bottom text-height dy) >> (pixel-scroll-precision-scroll-up dy))))) >> ``` > > Regardless of your problem, at the first look I find the following in > your code suspicious: what thing do you expect pixel-scroll to scroll? > The WINDOW is never selected so your current buffer and the selected > window are possibly not associated. I tried `(with-selected-window window...` instead of and also in addition to `with-current-buffer`, but the effect is the same. -- Joost Kremers Life has its moments