emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a built-in way to tell how many lines are in a window in a


From: Eli Zaretskii
Subject: Re: Is there a built-in way to tell how many lines are in a window in a given face?
Date: Sat, 15 Apr 2017 10:44:58 +0300

> From: Zachary Kanfer <address@hidden>
> Date: Sat, 15 Apr 2017 01:14:43 -0400
> 
> (defun zck--window-max-lines-per-window (face &optional window)
> "Calculate how many lines of text with face FACE can fit in WINDOW."
> (truncate (window-body-height window t)
> (window-font-height window face)))

This doesn't take line-spacing into account, I think.

What are the use cases where you need these metrics of the window?
I'm not sure I understand the need for these facilities; e.g., why not
do all your calculations in pixels?  Or maybe fit-window-to-buffer
will do what you want?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]