text-scale-mode uses a buffer-local
face-remapping-alist to scale the buffer's text, adding values like
(:height 1.2). It stores a "cookie" with the scaling it has applied in another local variable,
text-scale-mode-remapping, and uses this to locate and remove previous scalings whenever the height needs to be reset.
text-scale-mode-remapping are marked as permanent-local, so any event that wipes out buffer-local variables (e.g. changing major-modes) will clear them both. From text-scale-mode's perspective, this is fine: clearing
face-remapping-alist causes the height to be reset, so there's no need to preserve
face-remapping-alist to change the background color of certain buffers, and want this to persist even when buffer-local variables are cleared, so I've marked it as permanent-local. This causes problems for text-scale-mode when local variables are cleared: it's height adjustments survive, but its memory of having applied them is lost when
text-scale-mode-remapping is cleared. I can increase/decrease the height, but attempting to reset it to its true default just resets it to the height it had last time local variables were cleared.
I've fixed this by marking
text-scale-mode-remapping permanent-local as well. I considered submitting a bug-report for text-scale-mode, but it only makes sense to mark
text-scale-mode-remapping permanent local if
face-remapping-alist is permanent-local too, and I don't know if that's a desireable default. I prefer it that way, but maybe there are other use-cases where it's not?