0

(window-total-width) returns the number of columns (characters) that fit in the current window (https://www.gnu.org/software/emacs/manual/html_node/elisp/Window-Sizes.html). This will take the current font into account. My header line or mode line might have a different font from the text area (window body). How can I get the number of columns (characters) that fit there instead?

  • The mode-line fits in a dedicated window ... have you tried measuring that window expressly, e.g., with-selected-window ....? – lawlist Feb 26 at 21:06
1
(/ (window-pixel-width)
   (window-font-width nil face))

will return the current window width for a given face.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.