[Top][All Lists]

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

Re: Making windows have same number of columns

From: Stephen Berman
Subject: Re: Making windows have same number of columns
Date: Thu, 26 Nov 2020 23:05:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Thu, 26 Nov 2020 22:42:57 +0100 wrote:

> Have started with the following, but when I execute it, nothing happens.
> (defun typh-text-scale ()
>    (interactive)
>    (setq width (window-body-width))
>    (while (< width 72)
>      (text-scale-adjust -)
>      (setq width (window-body-width)) ))

Changing the font size with text-scale-adjust has no affect on
window-body-width; you can only change that by using
shrink-window-horizontally or enlarge-window-horizontally if your frame
has two or more side-by-side windows, or else if you change the width of
the frame.

On Thu, 26 Nov 2020 22:19:48 +0100 wrote:

> A solution could be to make a defun that performs (text-scale-adjust -)
> until (window-body-width) is less than a number N.

Instead of changing the window width, one at first sight plausible idea
is to check the column at the end the longest line in the buffer after
each application of text-scale-adjust; unfortunately, this doesn't work,
because using text-scale-adjust does not change how many columns a line
takes up: e.g., if the longest line ends at column 82 and
window-body-width is 72, then after apply text-scale-adjust until the
longest line appears to be shorter than 72, it still ends at column 82.
In other words, text-scale-adjust also adjusts the column width.  So
that approach won't work.  I can't think off hand of a way to get what
you want, but maybe someone else knows a way.

Steve Berman

reply via email to

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