unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62275: 28.2; Changing major mode changes the current text scaling
@ 2023-03-19 16:03 Drew Adams
  2023-03-19 16:47 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2023-03-19 16:03 UTC (permalink / raw)
  To: 62275

Maybe this is intended and documented somewhere - if so, feel free to
close it.  I haven't seen it mentioned, and it doesn't seem right to me.

emacs -Q

Use the mouse (with `C-') or keys to text-scale the buffer, e.g., to
enlarge the text size.

M-x emacs-lisp-mode

The text in the buffer (*scratch*) is resized back to its original size.
Should that happen?  If so, why - is that the right behavior?

In addition, if you then do `M-x lisp-interaction-mode', the text size
doesn't change back to the size you had scaled it to previously.

Text-scaling is per buffer, and the buffer hasn't changed.  Only the
major mode has changed.

I can guess that this is happening because changing the mode kills all
local variables.  But is this the intended behavior, i.e., what we want?
As a user, I find this unexpected (even a bit annoying).  I think users
will (and should) think of text-scaling as per buffer, not something
that's affected by changing the major mode.

I tried doing this, but it didn't fix the behavior.

(put 'text-scale-mode-remapping 'permanent-local t)
(put 'text-scale-mode-lighter 'permanent-local t)
(put 'text-scale-mode-amount 'permanent-local t)

Haven't tried to understand what's really going on - just reporting that
the behavior seems odd to me.

If there's (also) a good use case for the current behavior then maybe we
could have a user option, to choose whether a major-mode change resets
the text scale?

In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
 of 2022-09-13 built on AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Pro (v10.0.2009.19044.2604)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation
 --without-compress-install CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
XPM ZLIB

(NATIVE_COMP present but libgccjit not available)






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#62275: 28.2; Changing major mode changes the current text scaling
  2023-03-19 16:03 bug#62275: 28.2; Changing major mode changes the current text scaling Drew Adams
@ 2023-03-19 16:47 ` Eli Zaretskii
  2023-03-19 17:22   ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-03-19 16:47 UTC (permalink / raw)
  To: Drew Adams; +Cc: 62275

> From: Drew Adams <drew.adams@oracle.com>
> Date: Sun, 19 Mar 2023 16:03:26 +0000
> 
> emacs -Q
> 
> Use the mouse (with `C-') or keys to text-scale the buffer, e.g., to
> enlarge the text size.
> 
> M-x emacs-lisp-mode
> 
> The text in the buffer (*scratch*) is resized back to its original size.
> Should that happen?  If so, why - is that the right behavior?

Face remapping is a buffer-local behavior, and changing the major mode
kills all local variables.

> In addition, if you then do `M-x lisp-interaction-mode', the text size
> doesn't change back to the size you had scaled it to previously.

See above: the text-scale is not specific to the mode, it is a
buffer-local behavior, and modes have no memory of what that scaling
was.

> I can guess that this is happening because changing the mode kills all
> local variables.  But is this the intended behavior, i.e., what we want?

It isn't clear why we won't want that.

> I tried doing this, but it didn't fix the behavior.
> 
> (put 'text-scale-mode-remapping 'permanent-local t)
> (put 'text-scale-mode-lighter 'permanent-local t)
> (put 'text-scale-mode-amount 'permanent-local t)

You need to do this with face-remapping-alist.

> If there's (also) a good use case for the current behavior then maybe we
> could have a user option, to choose whether a major-mode change resets
> the text scale?

Sounds like creeping featurism to me.  If you want the text size
larger, then why not customize the default face, and have that done
once and for all?  Text-scale is by definition a temporary measure.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#62275: 28.2; Changing major mode changes the current text scaling
  2023-03-19 16:47 ` Eli Zaretskii
@ 2023-03-19 17:22   ` Drew Adams
  2023-03-19 17:40     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2023-03-19 17:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 62275@debbugs.gnu.org

> > I tried doing this, but it didn't fix the behavior.
> >
> > (put 'text-scale-mode-remapping 'permanent-local t)
> > (put 'text-scale-mode-lighter 'permanent-local t)
> > (put 'text-scale-mode-amount 'permanent-local t)
> 
> You need to do this with face-remapping-alist.

The request is not about _setting_ the remapping of any face or set of faces.

The request is for the effect of text-scaling, from _interactive_ use of `text-scale-adjust', to not be removed when the major mode is changed and the buffer isn't switched.

IOW, same buffer: keep its current scaling regardless of (only) major-mode changes.

> > If there's (also) a good use case for the current behavior then maybe we
> > could have a user option, to choose whether a major-mode change resets
> > the text scale?
> 
> Sounds like creeping featurism to me.  If you want the text size
> larger, then why not customize the default face, and have that done
> once and for all?  Text-scale is by definition a temporary measure.

I don't want the text size larger in general or by default - of any face, let alone face `default'.

It's about interactive use of `text-scale-adjust`.  Seems to me its behavior should be only buffer-specific and not affected by a major-mode change.  Is that not a reasonable behavior to want, if not even generally _expect_?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#62275: 28.2; Changing major mode changes the current text scaling
  2023-03-19 17:22   ` Drew Adams
@ 2023-03-19 17:40     ` Eli Zaretskii
  2023-03-19 21:50       ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-03-19 17:40 UTC (permalink / raw)
  To: Drew Adams; +Cc: 62275

> From: Drew Adams <drew.adams@oracle.com>
> CC: "62275@debbugs.gnu.org" <62275@debbugs.gnu.org>
> Date: Sun, 19 Mar 2023 17:22:39 +0000
> 
> > > I tried doing this, but it didn't fix the behavior.
> > >
> > > (put 'text-scale-mode-remapping 'permanent-local t)
> > > (put 'text-scale-mode-lighter 'permanent-local t)
> > > (put 'text-scale-mode-amount 'permanent-local t)
> > 
> > You need to do this with face-remapping-alist.
> 
> The request is not about _setting_ the remapping of any face or set of faces.
> 
> The request is for the effect of text-scaling, from _interactive_ use of `text-scale-adjust', to not be removed when the major mode is changed and the buffer isn't switched.

Text-scaling works via face-remapping.

> > Sounds like creeping featurism to me.  If you want the text size
> > larger, then why not customize the default face, and have that done
> > once and for all?  Text-scale is by definition a temporary measure.
> 
> I don't want the text size larger in general or by default - of any face, let alone face `default'.

But that's what text-scaling does: it enlarges the default face's
font.

> It's about interactive use of `text-scale-adjust`.  Seems to me its behavior should be only buffer-specific and not affected by a major-mode change.  Is that not a reasonable behavior to want, if not even generally _expect_?

No, not IMO.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#62275: 28.2; Changing major mode changes the current text scaling
  2023-03-19 17:40     ` Eli Zaretskii
@ 2023-03-19 21:50       ` Drew Adams
  2023-03-20 11:58         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2023-03-19 21:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 62275@debbugs.gnu.org

> Text-scaling works via face-remapping.

Yes, I know.  Again, it's not about _setting_
the scale once and for all.  It's not about a
user preference/option.  It's about interactive
change (such as what `text-scale-mode' does via
`face-remap-add-relative').

> > > Sounds like creeping featurism to me.  If you want the text size
> > > larger, then why not customize the default face, and have that done
> > > once and for all?  Text-scale is by definition a temporary measure.
> >
> > I don't want the text size larger in general or by default - of any
> face, let alone face `default'.
> 
> But that's what text-scaling does: it enlarges
> the default face's font.

You seem to be dancing around this.  Text-scaling
does NOT "customize the default face".

What's more, actually changing the font of face
`default' is the same as changing frame property
`font'.

And doing that changes the text size for ALL
windows in the frame - whatever buffers they
show, not just a single buffer.  And it does NOT,
as does text-scaling, change the text size for
all windows, on all frames, that display a given
buffer.

These are different things: (1) zooming a buffer
(everywhere) and (2) zooming a frame (all its
windows, whatever the buffers) and zooming
nothing in any other frame.

> > It's about interactive use of `text-scale-adjust`.  Seems to me its
> behavior should be only buffer-specific and not affected by a major-mode
> change.  Is that not a reasonable behavior to want, if not even generally
> _expect_?
> 
> No, not IMO.

OK.  Too bad.

AFAICT, what you said here repeats what I said:

  changing the major mode kills all local variables

and:

  the text-scale ... is a buffer-local behavior,
  and modes have no memory of what that scaling was.

I pointed out those things at the outset.

I was thinking that making those 3 buffer-local
variables permanently buffer-local would provide
that missing memory.  But it seems that making
`face-remapping-alist' permanently local does
just what I want.

I've added that possibility to my little library
`face-remap+.el', as a (global) minor mode.  The
library also provides another optional behavior
for text-scaling (also rejected for Emacs).

Might as well close this request as "won't fix",
I guess.  Thx.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#62275: 28.2; Changing major mode changes the current text scaling
  2023-03-19 21:50       ` Drew Adams
@ 2023-03-20 11:58         ` Eli Zaretskii
  2023-03-20 16:19           ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-03-20 11:58 UTC (permalink / raw)
  To: Drew Adams; +Cc: 62275

> From: Drew Adams <drew.adams@oracle.com>
> CC: "62275@debbugs.gnu.org" <62275@debbugs.gnu.org>
> Date: Sun, 19 Mar 2023 21:50:29 +0000
> 
> > But that's what text-scaling does: it enlarges
> > the default face's font.
> 
> You seem to be dancing around this.

Why the sarcasm/insult?  I don't have to have this conversation, and I
certainly won't if you keep this attitude.

> Text-scaling does NOT "customize the default face".

Of course, it does.

> What's more, actually changing the font of face
> `default' is the same as changing frame property
> `font'.

Yes, and that's equivalent to what text-scaling does.

> And doing that changes the text size for ALL
> windows in the frame - whatever buffers they
> show, not just a single buffer.

Yes, as expected.  Text-scaling, by contrast, is a buffer-local
behavior, and buffer-local behaviors get reset when the major mode
changes.

So we have no made the full circle.

> These are different things: (1) zooming a buffer
> (everywhere) and (2) zooming a frame (all its
> windows, whatever the buffers) and zooming
> nothing in any other frame.

Not very different, since we now have global-text-scale-adjust and
friends.

> AFAICT, what you said here repeats what I said:
> 
>   changing the major mode kills all local variables
> 
> and:
> 
>   the text-scale ... is a buffer-local behavior,
>   and modes have no memory of what that scaling was.
> 
> I pointed out those things at the outset.
> 
> I was thinking that making those 3 buffer-local
> variables permanently buffer-local would provide
> that missing memory.  But it seems that making
> `face-remapping-alist' permanently local does
> just what I want.

Yes.  As I pointed out at the outset.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#62275: 28.2; Changing major mode changes the current text scaling
  2023-03-20 11:58         ` Eli Zaretskii
@ 2023-03-20 16:19           ` Drew Adams
  2023-03-20 17:00             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2023-03-20 16:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 62275@debbugs.gnu.org

> > > But that's what text-scaling does: it enlarges
> > > the default face's font.
> >
> > You seem to be dancing around this.
> 
> Why the sarcasm/insult?  I don't have to have this conversation, and I
> certainly won't if you keep this attitude.

There's neither any sarcasm nor any insult there.
You're apparently seeing what you want to see.
Why do that?

> > Text-scaling does NOT "customize the default face".
> 
> Of course, it does.

For some meaning of "customize", perhaps.  I didn't
see any use of any `custom*' functions.  But I may
not have read the code carefully enough.

> > What's more, actually changing the font of face
> > `default' is the same as changing frame property
> > `font'.
> 
> Yes, and that's equivalent to what text-scaling does.
> 
> > And doing that changes the text size for ALL
> > windows in the frame - whatever buffers they
> > show, not just a single buffer.
> 
> Yes, as expected.  Text-scaling, by contrast, is a buffer-local
> behavior, and buffer-local behaviors get reset when the major mode
> changes.

I think you're confirming what I said.  Text-scaling
doesn't just change face `default' for a given frame.
If it did then that would affect only that frame, and
it would affect all windows showing any buffer in
that frame.

> > These are different things: (1) zooming a buffer
> > (everywhere) and (2) zooming a frame (all its
> > windows, whatever the buffers) and zooming
> > nothing in any other frame.
> 
> Not very different, since we now have
> global-text-scale-adjust and friends.	

Interesting.  I know nothing about such a command.
I don't see it in Emacs 28.2 (the latest release).
Does it zoom all windows (any buffers) in a frame?
Does it zoom only the current frame?
_____

At any rate, feel free to close this bug, as you
don't want to provide an easy option to make text
scaling be unaffected by major-mode changes in a
buffer.  By doing that I mean in a friendlier way
for users than them finding out they can do it by
(put 'face-remapping-alist 'permanent-local t).

Reminder: I proposed doing it.  All it takes is a
minor mode with a one-sexp body.  I've added that
to my face-remap+.el.  If you change your mind
then I'll be glad to be able to remove it.

(define-minor-mode text-scale-keep-mode
  "Keep the same text-scaling when a buffer changes major mode.
Disabling the mode restores the vanilla Emacs behavior, where changing
the major mode loses a buffer's current text-scaling.  This minor mode
is global: it affects all buffers."
  :init-value nil :global t
  (put 'face-remapping-alist 'permanent-local text-scale-keep-mode))





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#62275: 28.2; Changing major mode changes the current text scaling
  2023-03-20 16:19           ` Drew Adams
@ 2023-03-20 17:00             ` Eli Zaretskii
  2023-03-20 17:24               ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-03-20 17:00 UTC (permalink / raw)
  To: Drew Adams; +Cc: 62275-done

> From: Drew Adams <drew.adams@oracle.com>
> CC: "62275@debbugs.gnu.org" <62275@debbugs.gnu.org>
> Date: Mon, 20 Mar 2023 16:19:22 +0000
> 
> > > > But that's what text-scaling does: it enlarges
> > > > the default face's font.
> > >
> > > You seem to be dancing around this.
> > 
> > Why the sarcasm/insult?  I don't have to have this conversation, and I
> > certainly won't if you keep this attitude.
> 
> There's neither any sarcasm nor any insult there.
> You're apparently seeing what you want to see.
> Why do that?

I definitely wasn't "dancing".

> > > Text-scaling does NOT "customize the default face".
> > 
> > Of course, it does.
> 
> For some meaning of "customize", perhaps.  I didn't
> see any use of any `custom*' functions.  But I may
> not have read the code carefully enough.

Customization in our terminology doesn't necessarily mean one has to
use "M-x customize-SOMETHING".  A simple setq can also be a
customization, as well as some others.

> > Yes, as expected.  Text-scaling, by contrast, is a buffer-local
> > behavior, and buffer-local behaviors get reset when the major mode
> > changes.
> 
> I think you're confirming what I said.  Text-scaling
> doesn't just change face `default' for a given frame.

Text-scaling is a buffer-local change of a face.

> > > These are different things: (1) zooming a buffer
> > > (everywhere) and (2) zooming a frame (all its
> > > windows, whatever the buffers) and zooming
> > > nothing in any other frame.
> > 
> > Not very different, since we now have
> > global-text-scale-adjust and friends.	
> 
> Interesting.  I know nothing about such a command.
> I don't see it in Emacs 28.2 (the latest release).

It's new in Emacs 29.

> Does it zoom all windows (any buffers) in a frame?
> Does it zoom only the current frame?

It affects all faces on all frames.

> At any rate, feel free to close this bug

Done.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#62275: 28.2; Changing major mode changes the current text scaling
  2023-03-20 17:00             ` Eli Zaretskii
@ 2023-03-20 17:24               ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2023-03-20 17:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 62275-done@debbugs.gnu.org

> > > we now have global-text-scale-adjust and friends.
> >
> > Interesting.  I know nothing about such a command.
> > I don't see it in Emacs 28.2 (the latest release).
> 
> It's new in Emacs 29.
> 
> > Does it zoom all windows (any buffers) in a frame?
> > Does it zoom only the current frame?
> 
> It affects all faces on all frames.
> 
> > At any rate, feel free to close this bug
> 
> Done.

Thx.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-20 17:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-19 16:03 bug#62275: 28.2; Changing major mode changes the current text scaling Drew Adams
2023-03-19 16:47 ` Eli Zaretskii
2023-03-19 17:22   ` Drew Adams
2023-03-19 17:40     ` Eli Zaretskii
2023-03-19 21:50       ` Drew Adams
2023-03-20 11:58         ` Eli Zaretskii
2023-03-20 16:19           ` Drew Adams
2023-03-20 17:00             ` Eli Zaretskii
2023-03-20 17:24               ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).