问题
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)
回答1:
You can test with this:
(> (count-lines (point-min)
(point-max))
(window-height))
回答2:
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
.
来源:https://stackoverflow.com/questions/20923655/how-to-test-whether-lines-of-text-are-greater-than-the-window-height