* Making windows have same number of columns
@ 2020-11-26 14:43 daniela-spit
2020-11-26 16:03 ` Stephen Berman
0 siblings, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 14:43 UTC (permalink / raw)
To: Help Gnu Emacs
Does there exist a command to make all windows in a frame sized to
a certain number of columns?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 14:43 Making windows have same number of columns daniela-spit
@ 2020-11-26 16:03 ` Stephen Berman
2020-11-26 16:18 ` Stephen Berman
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Stephen Berman @ 2020-11-26 16:03 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs
On Thu, 26 Nov 2020 15:43:59 +0100 daniela-spit@gmx.it wrote:
> Does there exist a command to make all windows in a frame sized to
> a certain number of columns?
This question seems ambiguous: if you mean give each window a specific,
possibly different, number of columns, I don't know of such a command,
but if you mean what you wrote in the Subject line, there's
balance-windows, bound by default to `M-x +'.
Steve Berman
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 16:03 ` Stephen Berman
@ 2020-11-26 16:18 ` Stephen Berman
2020-11-26 17:16 ` daniela-spit
2020-11-26 18:26 ` daniela-spit
2 siblings, 0 replies; 23+ messages in thread
From: Stephen Berman @ 2020-11-26 16:18 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs
On Thu, 26 Nov 2020 17:03:41 +0100 Stephen Berman <stephen.berman@gmx.net> wrote:
> On Thu, 26 Nov 2020 15:43:59 +0100 daniela-spit@gmx.it wrote:
>
>> Does there exist a command to make all windows in a frame sized to
>> a certain number of columns?
>
> This question seems ambiguous: if you mean give each window a specific,
> possibly different, number of columns, I don't know of such a command,
> but if you mean what you wrote in the Subject line, there's
> balance-windows, bound by default to `M-x +'.
Oops, that should be `C-x +'.
Steve Berman
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 16:03 ` Stephen Berman
2020-11-26 16:18 ` Stephen Berman
@ 2020-11-26 17:16 ` daniela-spit
2020-11-26 18:26 ` daniela-spit
2 siblings, 0 replies; 23+ messages in thread
From: daniela-spit @ 2020-11-26 17:16 UTC (permalink / raw)
To: Stephen Berman; +Cc: Help Gnu Emacs
When I open a new file in a window, and have two windows,
the text is set too large and I got to zoom out the window
every time.
> Sent: Thursday, November 26, 2020 at 5:03 PM
> From: "Stephen Berman" <stephen.berman@gmx.net>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Making windows have same number of columns
>
> On Thu, 26 Nov 2020 15:43:59 +0100 daniela-spit@gmx.it wrote:
>
> > Does there exist a command to make all windows in a frame sized to
> > a certain number of columns?
>
> This question seems ambiguous: if you mean give each window a specific,
> possibly different, number of columns, I don't know of such a command,
> but if you mean what you wrote in the Subject line, there's
> balance-windows, bound by default to `M-x +'.
>
> Steve Berman
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 16:03 ` Stephen Berman
2020-11-26 16:18 ` Stephen Berman
2020-11-26 17:16 ` daniela-spit
@ 2020-11-26 18:26 ` daniela-spit
2020-11-26 18:55 ` Stephen Berman
2 siblings, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 18:26 UTC (permalink / raw)
To: Stephen Berman; +Cc: Help Gnu Emacs
Is there a command to make zoom in and out a window to a specific
number of columns?
> Sent: Thursday, November 26, 2020 at 5:03 PM
> From: "Stephen Berman" <stephen.berman@gmx.net>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Making windows have same number of columns
>
> On Thu, 26 Nov 2020 15:43:59 +0100 daniela-spit@gmx.it wrote:
>
> > Does there exist a command to make all windows in a frame sized to
> > a certain number of columns?
>
> This question seems ambiguous: if you mean give each window a specific,
> possibly different, number of columns, I don't know of such a command,
> but if you mean what you wrote in the Subject line, there's
> balance-windows, bound by default to `M-x +'.
>
> Steve Berman
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 18:26 ` daniela-spit
@ 2020-11-26 18:55 ` Stephen Berman
2020-11-26 19:01 ` daniela-spit
0 siblings, 1 reply; 23+ messages in thread
From: Stephen Berman @ 2020-11-26 18:55 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs
On Thu, 26 Nov 2020 19:26:39 +0100 daniela-spit@gmx.it wrote:
> Is there a command to make zoom in and out a window to a specific
> number of columns?
If you mean widen or narrow the selected window, there's
enlarge-window-horizontally and shrink-window-horizontally, bound
respectively to `C-x }' and `C-x {'. They both take a numeric prefix
argument, so e.g. `C-u 10 C-x }' widens the selected window by 10
columns.
Steve Berman
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 18:55 ` Stephen Berman
@ 2020-11-26 19:01 ` daniela-spit
2020-11-26 19:21 ` Stephen Berman
0 siblings, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 19:01 UTC (permalink / raw)
To: Stephen Berman; +Cc: Help Gnu Emacs
> Sent: Thursday, November 26, 2020 at 7:55 PM
> From: "Stephen Berman" <stephen.berman@gmx.net>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Making windows have same number of columns
>
> On Thu, 26 Nov 2020 19:26:39 +0100 daniela-spit@gmx.it wrote:
>
> > Is there a command to make zoom in and out a window to a specific
> > number of columns?
>
> If you mean widen or narrow the selected window, there's
> enlarge-window-horizontally and shrink-window-horizontally, bound
> respectively to `C-x }' and `C-x {'. They both take a numeric prefix
> argument, so e.g. `C-u 10 C-x }' widens the selected window by 10
> columns.
I would like that the window stays the same size, but with the size
of the text in the window to be such that the window displays a specific
number of columns.
> Steve Berman
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 19:01 ` daniela-spit
@ 2020-11-26 19:21 ` Stephen Berman
2020-11-26 19:30 ` daniela-spit
2020-11-26 19:33 ` daniela-spit
0 siblings, 2 replies; 23+ messages in thread
From: Stephen Berman @ 2020-11-26 19:21 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs
On Thu, 26 Nov 2020 20:01:24 +0100 daniela-spit@gmx.it wrote:
>> Sent: Thursday, November 26, 2020 at 7:55 PM
>> From: "Stephen Berman" <stephen.berman@gmx.net>
>> To: daniela-spit@gmx.it
>> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
>> Subject: Re: Making windows have same number of columns
>>
>> On Thu, 26 Nov 2020 19:26:39 +0100 daniela-spit@gmx.it wrote:
>>
>> > Is there a command to make zoom in and out a window to a specific
>> > number of columns?
>>
>> If you mean widen or narrow the selected window, there's
>> enlarge-window-horizontally and shrink-window-horizontally, bound
>> respectively to `C-x }' and `C-x {'. They both take a numeric prefix
>> argument, so e.g. `C-u 10 C-x }' widens the selected window by 10
>> columns.
>
> I would like that the window stays the same size, but with the size
> of the text in the window to be such that the window displays a specific
> number of columns.
I'm not aware of any command or function in Emacs that adjusts text size
according to number of columns. You've mentioned zooming in and out, by
which I assume you mean either `C-x C-+' and `C-x C-' or the
corresponding mouse binding <C-mouse-4> (i.e., holding down the Control
key while scrolling the mouse wheel). But that command is
text-scale-adjust, which actually changes the height of the font, and
correspondingly the width, but AFAIK you cannot make it adjust the font
size by a specific number of columns.
Steve Berman
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 19:21 ` Stephen Berman
@ 2020-11-26 19:30 ` daniela-spit
2020-11-26 19:41 ` Stephen Berman
2020-11-26 19:33 ` daniela-spit
1 sibling, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 19:30 UTC (permalink / raw)
To: Stephen Berman; +Cc: Help Gnu Emacs
> Sent: Thursday, November 26, 2020 at 8:21 PM
> From: "Stephen Berman" <stephen.berman@gmx.net>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Making windows have same number of columns
>
> On Thu, 26 Nov 2020 20:01:24 +0100 daniela-spit@gmx.it wrote:
>
> >> Sent: Thursday, November 26, 2020 at 7:55 PM
> >> From: "Stephen Berman" <stephen.berman@gmx.net>
> >> To: daniela-spit@gmx.it
> >> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> >> Subject: Re: Making windows have same number of columns
> >>
> >> On Thu, 26 Nov 2020 19:26:39 +0100 daniela-spit@gmx.it wrote:
> >>
> >> > Is there a command to make zoom in and out a window to a specific
> >> > number of columns?
> >>
> >> If you mean widen or narrow the selected window, there's
> >> enlarge-window-horizontally and shrink-window-horizontally, bound
> >> respectively to `C-x }' and `C-x {'. They both take a numeric prefix
> >> argument, so e.g. `C-u 10 C-x }' widens the selected window by 10
> >> columns.
> >
> > I would like that the window stays the same size, but with the size
> > of the text in the window to be such that the window displays a specific
> > number of columns.
>
> I'm not aware of any command or function in Emacs that adjusts text size
> according to number of columns. You've mentioned zooming in and out, by
> which I assume you mean either `C-x C-+' and `C-x C-' or the
> corresponding mouse binding <C-mouse-4> (i.e., holding down the Control
> key while scrolling the mouse wheel). But that command is
> text-scale-adjust, which actually changes the height of the font, and
> correspondingly the width, but AFAIK you cannot make it adjust the font
> size by a specific number of columns.
Yes, but when you use the scroll wheel you have no real control, one wheel
scroll down could get the text too small. I would like a way that stops
me fidgeting with the controls and lets me do what I want with simply
pressing a key sequence.
> Steve Berman
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 19:21 ` Stephen Berman
2020-11-26 19:30 ` daniela-spit
@ 2020-11-26 19:33 ` daniela-spit
1 sibling, 0 replies; 23+ messages in thread
From: daniela-spit @ 2020-11-26 19:33 UTC (permalink / raw)
To: Stephen Berman; +Cc: Help Gnu Emacs
> Sent: Thursday, November 26, 2020 at 8:21 PM
> From: "Stephen Berman" <stephen.berman@gmx.net>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Making windows have same number of columns
>
> On Thu, 26 Nov 2020 20:01:24 +0100 daniela-spit@gmx.it wrote:
>
> >> Sent: Thursday, November 26, 2020 at 7:55 PM
> >> From: "Stephen Berman" <stephen.berman@gmx.net>
> >> To: daniela-spit@gmx.it
> >> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> >> Subject: Re: Making windows have same number of columns
> >>
> >> On Thu, 26 Nov 2020 19:26:39 +0100 daniela-spit@gmx.it wrote:
> >>
> >> > Is there a command to make zoom in and out a window to a specific
> >> > number of columns?
> >>
> >> If you mean widen or narrow the selected window, there's
> >> enlarge-window-horizontally and shrink-window-horizontally, bound
> >> respectively to `C-x }' and `C-x {'. They both take a numeric prefix
> >> argument, so e.g. `C-u 10 C-x }' widens the selected window by 10
> >> columns.
> >
> > I would like that the window stays the same size, but with the size
> > of the text in the window to be such that the window displays a specific
> > number of columns.
>
> I'm not aware of any command or function in Emacs that adjusts text size
> according to number of columns. You've mentioned zooming in and out, by
> which I assume you mean either `C-x C-+' and `C-x C-' or the
> corresponding mouse binding <C-mouse-4> (i.e., holding down the Control
> key while scrolling the mouse wheel). But that command is
> text-scale-adjust, which actually changes the height of the font, and
> correspondingly the width, but AFAIK you cannot make it adjust the font
> size by a specific number of columns.
No, you can't. But that not what I am after. What I need is text-scale-adjust
that gets as close as possible to fitting n characters, 55 say.
> Steve Berman
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 19:30 ` daniela-spit
@ 2020-11-26 19:41 ` Stephen Berman
2020-11-26 20:22 ` daniela-spit
0 siblings, 1 reply; 23+ messages in thread
From: Stephen Berman @ 2020-11-26 19:41 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs
On Thu, 26 Nov 2020 20:30:46 +0100 daniela-spit@gmx.it wrote:
>> Sent: Thursday, November 26, 2020 at 8:21 PM
>> From: "Stephen Berman" <stephen.berman@gmx.net>
>> To: daniela-spit@gmx.it
>> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
>> Subject: Re: Making windows have same number of columns
>>
>> On Thu, 26 Nov 2020 20:01:24 +0100 daniela-spit@gmx.it wrote:
>>
>> >> Sent: Thursday, November 26, 2020 at 7:55 PM
>> >> From: "Stephen Berman" <stephen.berman@gmx.net>
>> >> To: daniela-spit@gmx.it
>> >> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
>> >> Subject: Re: Making windows have same number of columns
>> >>
>> >> On Thu, 26 Nov 2020 19:26:39 +0100 daniela-spit@gmx.it wrote:
>> >>
>> >> > Is there a command to make zoom in and out a window to a specific
>> >> > number of columns?
>> >>
>> >> If you mean widen or narrow the selected window, there's
>> >> enlarge-window-horizontally and shrink-window-horizontally, bound
>> >> respectively to `C-x }' and `C-x {'. They both take a numeric prefix
>> >> argument, so e.g. `C-u 10 C-x }' widens the selected window by 10
>> >> columns.
>> >
>> > I would like that the window stays the same size, but with the size
>> > of the text in the window to be such that the window displays a specific
>> > number of columns.
>>
>> I'm not aware of any command or function in Emacs that adjusts text size
>> according to number of columns. You've mentioned zooming in and out, by
>> which I assume you mean either `C-x C-+' and `C-x C-' or the
>> corresponding mouse binding <C-mouse-4> (i.e., holding down the Control
>> key while scrolling the mouse wheel). But that command is
>> text-scale-adjust, which actually changes the height of the font, and
>> correspondingly the width, but AFAIK you cannot make it adjust the font
>> size by a specific number of columns.
>
> Yes, but when you use the scroll wheel you have no real control, one wheel
> scroll down could get the text too small. I would like a way that stops
> me fidgeting with the controls and lets me do what I want with simply
> pressing a key sequence.
As noted, you can use the key sequences `C-x C-+' and `C-x C-' instead
of the mouse scroll wheel.
On Thu, 26 Nov 2020 20:33:32 +0100 daniela-spit@gmx.it wrote:
> No, you can't. But that not what I am after. What I need is text-scale-adjust
> that gets as close as possible to fitting n characters, 55 say.
You can try customizing text-scale-mode-step to a smaller value, though
there's not a great deal of leeway, since its default value is 1.2 and
it has to be >1.0 to have an effect. You might try 1.1 or even a bit
less and see if that gives you more control.
Steve Berman
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 19:41 ` Stephen Berman
@ 2020-11-26 20:22 ` daniela-spit
2020-11-26 20:31 ` Stephen Berman
0 siblings, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 20:22 UTC (permalink / raw)
To: Stephen Berman; +Cc: Help Gnu Emacs
> Sent: Thursday, November 26, 2020 at 8:41 PM
> From: "Stephen Berman" <stephen.berman@gmx.net>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Making windows have same number of columns
>
> On Thu, 26 Nov 2020 20:30:46 +0100 daniela-spit@gmx.it wrote:
>
> >> Sent: Thursday, November 26, 2020 at 8:21 PM
> >> From: "Stephen Berman" <stephen.berman@gmx.net>
> >> To: daniela-spit@gmx.it
> >> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> >> Subject: Re: Making windows have same number of columns
> >>
> >> On Thu, 26 Nov 2020 20:01:24 +0100 daniela-spit@gmx.it wrote:
> >>
> >> >> Sent: Thursday, November 26, 2020 at 7:55 PM
> >> >> From: "Stephen Berman" <stephen.berman@gmx.net>
> >> >> To: daniela-spit@gmx.it
> >> >> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> >> >> Subject: Re: Making windows have same number of columns
> >> >>
> >> >> On Thu, 26 Nov 2020 19:26:39 +0100 daniela-spit@gmx.it wrote:
> >> >>
> >> >> > Is there a command to make zoom in and out a window to a specific
> >> >> > number of columns?
> >> >>
> >> >> If you mean widen or narrow the selected window, there's
> >> >> enlarge-window-horizontally and shrink-window-horizontally, bound
> >> >> respectively to `C-x }' and `C-x {'. They both take a numeric prefix
> >> >> argument, so e.g. `C-u 10 C-x }' widens the selected window by 10
> >> >> columns.
> >> >
> >> > I would like that the window stays the same size, but with the size
> >> > of the text in the window to be such that the window displays a specific
> >> > number of columns.
> >>
> >> I'm not aware of any command or function in Emacs that adjusts text size
> >> according to number of columns. You've mentioned zooming in and out, by
> >> which I assume you mean either `C-x C-+' and `C-x C-' or the
> >> corresponding mouse binding <C-mouse-4> (i.e., holding down the Control
> >> key while scrolling the mouse wheel). But that command is
> >> text-scale-adjust, which actually changes the height of the font, and
> >> correspondingly the width, but AFAIK you cannot make it adjust the font
> >> size by a specific number of columns.
> >
> > Yes, but when you use the scroll wheel you have no real control, one wheel
> > scroll down could get the text too small. I would like a way that stops
> > me fidgeting with the controls and lets me do what I want with simply
> > pressing a key sequence.
>
> As noted, you can use the key sequences `C-x C-+' and `C-x C-' instead
> of the mouse scroll wheel.
>
> On Thu, 26 Nov 2020 20:33:32 +0100 daniela-spit@gmx.it wrote:
>
> > No, you can't. But that not what I am after. What I need is text-scale-adjust
> > that gets as close as possible to fitting n characters, 55 say.
>
> You can try customizing text-scale-mode-step to a smaller value, though
> there's not a great deal of leeway, since its default value is 1.2 and
> it has to be >1.0 to have an effect. You might try 1.1 or even a bit
> less and see if that gives you more control.
Have tried it out and things are a bit better as it does not scale too much.
Once I do the scaling, is there a way to determine now many columns are visible
in a buffer?
> Steve Berman
>
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 20:22 ` daniela-spit
@ 2020-11-26 20:31 ` Stephen Berman
2020-11-26 21:19 ` daniela-spit
2020-11-26 21:42 ` daniela-spit
0 siblings, 2 replies; 23+ messages in thread
From: Stephen Berman @ 2020-11-26 20:31 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs
On Thu, 26 Nov 2020 21:22:28 +0100 daniela-spit@gmx.it wrote:
>> You can try customizing text-scale-mode-step to a smaller value, though
>> there's not a great deal of leeway, since its default value is 1.2 and
>> it has to be >1.0 to have an effect. You might try 1.1 or even a bit
>> less and see if that gives you more control.
>
> Have tried it out and things are a bit better as it does not scale too much.
> Once I do the scaling, is there a way to determine now many columns are visible
> in a buffer?
M-: (window-body-width)
Steve Berman
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 20:31 ` Stephen Berman
@ 2020-11-26 21:19 ` daniela-spit
2020-11-26 22:05 ` Stephen Berman
2020-11-26 21:42 ` daniela-spit
1 sibling, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 21:19 UTC (permalink / raw)
To: Stephen Berman; +Cc: Help Gnu Emacs
A solution could be to make a defun that performs (text-scale-adjust -)
until (window-body-width) is less than a number N.
> Sent: Thursday, November 26, 2020 at 9:31 PM
> From: "Stephen Berman" <stephen.berman@gmx.net>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Making windows have same number of columns
>
> On Thu, 26 Nov 2020 21:22:28 +0100 daniela-spit@gmx.it wrote:
>
> >> You can try customizing text-scale-mode-step to a smaller value, though
> >> there's not a great deal of leeway, since its default value is 1.2 and
> >> it has to be >1.0 to have an effect. You might try 1.1 or even a bit
> >> less and see if that gives you more control.
> >
> > Have tried it out and things are a bit better as it does not scale too much.
> > Once I do the scaling, is there a way to determine now many columns are visible
> > in a buffer?
>
> M-: (window-body-width)
>
> Steve Berman
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 20:31 ` Stephen Berman
2020-11-26 21:19 ` daniela-spit
@ 2020-11-26 21:42 ` daniela-spit
2020-11-27 20:40 ` Michael Heerdegen
1 sibling, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 21:42 UTC (permalink / raw)
To: Stephen Berman; +Cc: Help Gnu Emacs
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)) ))
> Sent: Thursday, November 26, 2020 at 9:31 PM
> From: "Stephen Berman" <stephen.berman@gmx.net>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Making windows have same number of columns
>
> On Thu, 26 Nov 2020 21:22:28 +0100 daniela-spit@gmx.it wrote:
>
> >> You can try customizing text-scale-mode-step to a smaller value, though
> >> there's not a great deal of leeway, since its default value is 1.2 and
> >> it has to be >1.0 to have an effect. You might try 1.1 or even a bit
> >> less and see if that gives you more control.
> >
> > Have tried it out and things are a bit better as it does not scale too much.
> > Once I do the scaling, is there a way to determine now many columns are visible
> > in a buffer?
>
> M-: (window-body-width)
>
> Steve Berman
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 21:19 ` daniela-spit
@ 2020-11-26 22:05 ` Stephen Berman
2020-11-26 23:01 ` Drew Adams
2020-11-27 15:37 ` Stephen Berman
0 siblings, 2 replies; 23+ messages in thread
From: Stephen Berman @ 2020-11-26 22:05 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs
On Thu, 26 Nov 2020 22:42:57 +0100 daniela-spit@gmx.it 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 daniela-spit@gmx.it 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: Making windows have same number of columns
2020-11-26 22:05 ` Stephen Berman
@ 2020-11-26 23:01 ` Drew Adams
2020-11-26 23:07 ` daniela-spit
2020-11-27 15:37 ` Stephen Berman
1 sibling, 1 reply; 23+ messages in thread
From: Drew Adams @ 2020-11-26 23:01 UTC (permalink / raw)
To: Stephen Berman, daniela-spit; +Cc: Help Gnu Emacs
> 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.
This doesn't directly address the original question, but FWIW:
Library `face-remap+.el' makes the `text-scale-*'
functions respect this new user option:
,----
| text-scale-resize-window is a variable defined in `face-remap+.el'.
| Its value is t
|
| Documentation:
| Non-nil means text scaling resizes the window or frame accordingly.
| For example, if you use `C-x C--' (`text-scale-decrease')' to make the
| text smaller, then the window or frame is made smaller by a similar
| factor.
|
| If the window is not alone in its frame, then the window is resized.
| Otherwise, the frame is resized (provided you also use library
| `fit-frame.el'). The frame is always resized both horizontally and
| vertically.
|
| You can customize this variable.
`----
One aim behind this is to not waste horizontal
whitespace in the window when you reduce the
displayed text size.
You can likely use similar code to get the
requested effect.
https://www.emacswiki.org/emacs/download/face-remap%2b.el
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RE: Making windows have same number of columns
2020-11-26 23:01 ` Drew Adams
@ 2020-11-26 23:07 ` daniela-spit
2020-11-26 23:55 ` daniela-spit
0 siblings, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 23:07 UTC (permalink / raw)
To: Drew Adams; +Cc: Help Gnu Emacs, Stephen Berman
> Sent: Friday, November 27, 2020 at 12:01 AM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Stephen Berman" <stephen.berman@gmx.net>, daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: RE: Making windows have same number of columns
>
> > 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.
>
> This doesn't directly address the original question, but FWIW:
>
> Library `face-remap+.el' makes the `text-scale-*'
> functions respect this new user option:
>
> ,----
> | text-scale-resize-window is a variable defined in `face-remap+.el'.
> | Its value is t
> |
> | Documentation:
> | Non-nil means text scaling resizes the window or frame accordingly.
> | For example, if you use `C-x C--' (`text-scale-decrease')' to make the
> | text smaller, then the window or frame is made smaller by a similar
> | factor.
> |
> | If the window is not alone in its frame, then the window is resized.
> | Otherwise, the frame is resized (provided you also use library
> | `fit-frame.el'). The frame is always resized both horizontally and
> | vertically.
> |
> | You can customize this variable.
> `----
>
> One aim behind this is to not waste horizontal
> whitespace in the window when you reduce the
> displayed text size.
Spot on, that is the fundamental problem.
> You can likely use similar code to get the
> requested effect.
>
> https://www.emacswiki.org/emacs/download/face-remap%2b.el
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RE: Making windows have same number of columns
2020-11-26 23:07 ` daniela-spit
@ 2020-11-26 23:55 ` daniela-spit
2020-11-27 0:51 ` Drew Adams
0 siblings, 1 reply; 23+ messages in thread
From: daniela-spit @ 2020-11-26 23:55 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs, Stephen Berman
Have tried to use it. Have done as follows
(setq dface-remap
"/home/dani/el/dface-remap.el")
(load dface-remap)
(require 'face-remap+)
When I called "C-u 1 M-x text-scale-increase"
But the effect seems to be the same as it has always been.
> Sent: Friday, November 27, 2020 at 12:07 AM
> From: daniela-spit@gmx.it
> To: "Drew Adams" <drew.adams@oracle.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>, "Stephen Berman" <stephen.berman@gmx.net>
> Subject: Re: RE: Making windows have same number of columns
>
>
>
> > Sent: Friday, November 27, 2020 at 12:01 AM
> > From: "Drew Adams" <drew.adams@oracle.com>
> > To: "Stephen Berman" <stephen.berman@gmx.net>, daniela-spit@gmx.it
> > Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > Subject: RE: Making windows have same number of columns
> >
> > > 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.
> >
> > This doesn't directly address the original question, but FWIW:
> >
> > Library `face-remap+.el' makes the `text-scale-*'
> > functions respect this new user option:
> >
> > ,----
> > | text-scale-resize-window is a variable defined in `face-remap+.el'.
> > | Its value is t
> > |
> > | Documentation:
> > | Non-nil means text scaling resizes the window or frame accordingly.
> > | For example, if you use `C-x C--' (`text-scale-decrease')' to make the
> > | text smaller, then the window or frame is made smaller by a similar
> > | factor.
> > |
> > | If the window is not alone in its frame, then the window is resized.
> > | Otherwise, the frame is resized (provided you also use library
> > | `fit-frame.el'). The frame is always resized both horizontally and
> > | vertically.
> > |
> > | You can customize this variable.
> > `----
> >
> > One aim behind this is to not waste horizontal
> > whitespace in the window when you reduce the
> > displayed text size.
>
> Spot on, that is the fundamental problem.
>
> > You can likely use similar code to get the
> > requested effect.
> >
> > https://www.emacswiki.org/emacs/download/face-remap%2b.el
> >
> >
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: RE: Making windows have same number of columns
2020-11-26 23:55 ` daniela-spit
@ 2020-11-27 0:51 ` Drew Adams
2020-11-27 1:03 ` daniela-spit
0 siblings, 1 reply; 23+ messages in thread
From: Drew Adams @ 2020-11-27 0:51 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs, Stephen Berman
> Have tried to use it. Have done as follows
>
> (setq dface-remap
> "/home/dani/el/dface-remap.el")
> (load dface-remap)
> (require 'face-remap+)
No idea what dface-remap does or whether it interferes.
To repeat part of the help:
If option `text-scale-resize-window' is non-nil,
then the selected window or frame is resized
accordingly, so as to keep roughly the same text
^^^^^^^^^^^^^^^^^^^^^^^^^^
visible in the window.
^^^^^^^^^^^^^^^^^^^^^
That's the effect you should see from that option.
Try 2 windows side-by-side, `C-x C-- - - -' in one.
If the option value is `horizontally' or `vertically'
then the resizing is only in that dimension.
If you see something different then please provide
a recipe (from `emacs -Q') to show that.
The code just uses standard functions
`enlarge-window-(horizontally|vertically)'.
(If you have library `fit-frame.el' and there's
only one window in the frame then it resizes the
frame as the text is scaled - again, to eliminate
wasted space.)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-27 0:51 ` Drew Adams
@ 2020-11-27 1:03 ` daniela-spit
0 siblings, 0 replies; 23+ messages in thread
From: daniela-spit @ 2020-11-27 1:03 UTC (permalink / raw)
To: Drew Adams; +Cc: Help Gnu Emacs, Stephen Berman
> Sent: Friday, November 27, 2020 at 1:51 AM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: daniela-spit@gmx.it
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>, "Stephen Berman" <stephen.berman@gmx.net>
> Subject: RE: RE: Making windows have same number of columns
>
> > Have tried to use it. Have done as follows
> >
> > (setq dface-remap
> > "/home/dani/el/dface-remap.el")
> > (load dface-remap)
> > (require 'face-remap+)
It is your file, just added d in font of the file name.
> No idea what dface-remap does or whether it interferes.
>
> To repeat part of the help:
>
> If option `text-scale-resize-window' is non-nil,
> then the selected window or frame is resized
> accordingly, so as to keep roughly the same text
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> visible in the window.
> ^^^^^^^^^^^^^^^^^^^^^
>
> That's the effect you should see from that option.
>
> Try 2 windows side-by-side, `C-x C-- - - -' in one.
>
> If the option value is `horizontally' or `vertically'
> then the resizing is only in that dimension.
>
> If you see something different then please provide
> a recipe (from `emacs -Q') to show that.
>
> The code just uses standard functions
> `enlarge-window-(horizontally|vertically)'.
>
> (If you have library `fit-frame.el' and there's
> only one window in the frame then it resizes the
> frame as the text is scaled - again, to eliminate
> wasted space.)
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 22:05 ` Stephen Berman
2020-11-26 23:01 ` Drew Adams
@ 2020-11-27 15:37 ` Stephen Berman
1 sibling, 0 replies; 23+ messages in thread
From: Stephen Berman @ 2020-11-27 15:37 UTC (permalink / raw)
To: daniela-spit; +Cc: Help Gnu Emacs
On Thu, 26 Nov 2020 23:05:08 +0100 Stephen Berman <stephen.berman@gmx.net> wrote:
> On Thu, 26 Nov 2020 22:19:48 +0100 daniela-spit@gmx.it 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.
I did think of a way after all:
(defun srb-shrink-font ()
"Shrink font to make longest line fit in window width."
(interactive)
(save-excursion
(let ((max 0) line)
(goto-char (point-min))
(while (not (eobp))
(let* ((inhibit-field-text-motion t)
(col (progn (end-of-line) (current-column))))
(when (> col max)
(setq max col)
(setq line (line-beginning-position)))
(forward-line)))
(goto-char line))
(let ((eol (line-end-position))
(eovl (lambda () (progn (end-of-visual-line) (point)))))
(while (> eol (funcall eovl))
(let ((text-scale-mode-step 1.05))
(text-scale-decrease 1))))))
But I suspect there will be many cases where the result isn't really
satisfying. You can experiment with text-scale-mode-step: in the above
I let-bound it to the smallest value that seemed to work reasonably
well, but sometimes it still seems to shrink the font too much and other
times not enough. I think this has to do with the algorithm
text-scale-adjust uses to change the size, using exponentiation, which
means that sometimes the change will be too small for the available font
sizes and other times too large. I also didn't implement the case of
increasing the font size, because the only way I could think of to do
that involves increasing too much and then decreasing again, which
probably is visually annoying.
Steve Berman
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Making windows have same number of columns
2020-11-26 21:42 ` daniela-spit
@ 2020-11-27 20:40 ` Michael Heerdegen
0 siblings, 0 replies; 23+ messages in thread
From: Michael Heerdegen @ 2020-11-27 20:40 UTC (permalink / raw)
To: help-gnu-emacs
daniela-spit@gmx.it writes:
> (while (< width 72)
> (text-scale-adjust -)
> [...]
The second line will cause an error.
Michael.
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2020-11-27 20:40 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-26 14:43 Making windows have same number of columns daniela-spit
2020-11-26 16:03 ` Stephen Berman
2020-11-26 16:18 ` Stephen Berman
2020-11-26 17:16 ` daniela-spit
2020-11-26 18:26 ` daniela-spit
2020-11-26 18:55 ` Stephen Berman
2020-11-26 19:01 ` daniela-spit
2020-11-26 19:21 ` Stephen Berman
2020-11-26 19:30 ` daniela-spit
2020-11-26 19:41 ` Stephen Berman
2020-11-26 20:22 ` daniela-spit
2020-11-26 20:31 ` Stephen Berman
2020-11-26 21:19 ` daniela-spit
2020-11-26 22:05 ` Stephen Berman
2020-11-26 23:01 ` Drew Adams
2020-11-26 23:07 ` daniela-spit
2020-11-26 23:55 ` daniela-spit
2020-11-27 0:51 ` Drew Adams
2020-11-27 1:03 ` daniela-spit
2020-11-27 15:37 ` Stephen Berman
2020-11-26 21:42 ` daniela-spit
2020-11-27 20:40 ` Michael Heerdegen
2020-11-26 19:33 ` daniela-spit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).