unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should `revert-buffer' preserve text-scaling by default?
@ 2019-11-29 20:24 Karl Fogel
  2019-11-29 20:39 ` Eli Zaretskii
  2019-12-01 21:49 ` Juri Linkov
  0 siblings, 2 replies; 26+ messages in thread
From: Karl Fogel @ 2019-11-29 20:24 UTC (permalink / raw)
  To: Emacs Devel

Currently, when you do `revert-buffer' it will discard any text scale changes done in that buffer (i.e., done via "C-x C-+" / `text-scale-adjust').  

The effect -- unexpected to me at least -- is that when I revert a buffer whose text size I have increased, the text suddenly shrinks down again (to whatever the default text scale was).

Before I "fix" this, I'd like to know if others consider it a bug or a feature.

The reason the text scale currently gets reverted is that text-scaling happens to be implemented via the minor mode `text-scale-mode'.  Since `revert-buffer' doesn't preserve modes by default, text-scaling is lost when one reverts.  There is an optional `preserve-modes' argument to `revert-buffer', but I don't think that just making wrapper that sets that argument to non-nil is a good solution here, because that would preserve *all* the modes.  From the user's point of view, the fact that text-scaling happens to be implemented via a minor mode is irrelevant and is probably not something most users are even aware of.  Text-scaling is more like a magnifying glass (or reducing glass) that one places over the text of a particular buffer.  Reverting the buffer to its original content is somethi
 ng that happens "under" the glass -- there's no reason reverting should change the magnification/reduction level.

We could fix this by making `revert-buffer--default' preserve `text-scale-mode' and `text-scale-amount', either unconditionally or conditionally based on a new variable `revert-buffer-preserve-text-scale'.  I would be fine with either solution; if conditional, I would opt for `revert-buffer-preserve-text-scale' being true by default.  (Note that if someone has written a custom `revert-buffer-function' to be used instead of `revert-buffer--default', then we should let their custom function decide what to do about text-scaling; it can choose whether or not to honor a `revert-buffer-preserve-text-scale' variable.)

Before I go down this road, I'd like to know if anyone thinks text-scaling is just another minor mode and should be bound together with other modes via the existing `preserve-modes' flag to `revert-buffer'.  I think the opposite: that is, I think text-scaling should be treated specially, for the reasons given above.  I just wanted to check here before writing any code.

Best regards,
-Karl



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

end of thread, other threads:[~2019-12-03 17:35 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-29 20:24 Should `revert-buffer' preserve text-scaling by default? Karl Fogel
2019-11-29 20:39 ` Eli Zaretskii
2019-11-29 21:02   ` Karl Fogel
2019-11-30  7:24     ` Eli Zaretskii
2019-11-29 21:09   ` Stefan Monnier
2019-11-29 21:20     ` Karl Fogel
2019-11-30  7:22       ` Eli Zaretskii
2019-12-01  8:15         ` Karl Fogel
2019-12-01  9:47           ` Stefan Kangas
2019-12-01 10:24             ` Juanma Barranquero
2019-12-01 17:38               ` Eli Zaretskii
2019-12-01 10:27             ` Michael Albinus
2019-12-01 17:35               ` Karl Fogel
2019-12-01 18:25           ` Stefan Monnier
2019-12-02  2:01             ` Karl Fogel
2019-12-02 16:15               ` Eli Zaretskii
2019-12-02 17:19                 ` Karl Fogel
2019-12-02 17:42                   ` Eli Zaretskii
2019-12-02 22:29                     ` Karl Fogel
2019-12-02 22:49                       ` Stefan Monnier
2019-12-03  0:36                         ` Karl Fogel
2019-12-03 16:11                           ` Eli Zaretskii
2019-12-03 16:10                         ` Eli Zaretskii
2019-12-03 16:09                       ` Eli Zaretskii
2019-12-03 17:35                         ` Karl Fogel
2019-12-01 21:49 ` Juri Linkov

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