help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Changing height to fit window


From: Eli Zaretskii
Subject: Re: Changing height to fit window
Date: Wed, 30 Nov 2022 14:23:36 +0200

> Date: Tue, 29 Nov 2022 20:37:03 +0000
> From: Heime <heimeborgia@protonmail.com>
> 
> 
> One can C-x C-+ and C-x C-- to call text-scale-adjust, 
> which increases or decreases the buffer text size, with
> C-+ or C-- to repeat.
> 
> Instead of repeating, I want to have a function that adjusts
> the scale so that the contents of the buffer fit the window,
> based on the longest line.  What can I do?

Ask Emacs about the pixel-height of the text, then compute the scale you
need to make that the same as the pixel-height of the window's body.

Caveat: when you change the font size, some lines could take more or fewer
lines on the screen (due to wrapping) and disrupt your calculations.
Dealing with that is left as an exercise.



reply via email to

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