Re: Position buffer contents at bottom of window
Michael Heerdegen via Users list for the GNU Emacs text editor <[email protected]> Wed, 24 Jun 2026 16:44:42 +0200
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
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. Michael.