I'd like to test, please, whether the lines of text in a no-file visiting buffer are greater than the window height -- if not, then
(set-window-scroll-bars (get-buffer-window "*Org Agenda*" (selected-frame)) 0 nil)
Comparing count-lines with window-height works in some cases but doesn't account for line-wrapping, images, and variable-sized fonts. Another approch is to check if window-end
is before point-max
.
You can test with this:
(> (count-lines (point-min)
(point-max))
(window-height))