[Top][All Lists]

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

Re: Should `revert-buffer' preserve text-scaling by default?

From: Karl Fogel
Subject: Re: Should `revert-buffer' preserve text-scaling by default?
Date: Sun, 01 Dec 2019 20:01:37 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On 01 Dec 2019, Stefan Monnier wrote:
>FWIW, I think that this is in the eye of the beholder.
>In my opinion, we should move towards an arrangement where the
>revert-buffer command focuses on synchronizing the buffer's state with
>the external world (e.g. text content, read-only-mode, VC state, ...)
>and then have another command for resetting the modes (probably

I think that would be a good direction to move in.  How would that differ, in 
essence, from my proposal (earlier in this thread) to have `revert-buffer' not 
reset modes by default?  After I proposed it, Eli persuaded me that that would 
be too big a change and that for compatibility reasons we shouldn't do it.

I'm easily unpersuaded from that recent persuasion, though... Frankly, I think 
we don't have much empirical knowledge about what users want/expect from 
`revert-buffer' beyond reverting files contents.  The fact that it clobbers 
modes seems somewhat random.  I suspect the mode-clobbering was probably 
designed for some specific use case, and afterwards as people created new modes 
they were almost never thinking about whether `revert-buffer' should revert 
their new mode or not, because they usually weren't aware that `revert-buffer' 
does that at all.

The `preserve-modes' argument was added by Richard (commit 9a30563f9) probably 
in order to help `vc-revert-buffer1' (commit e7ffe86a9068).  I wish at that 
point, in 1995, we had stopped to ask ourselves why `revert-buffer' was 
clobbering modes in the first place.  But we didn't, and now it's 24 years and 
about ten zillion new modes later :-), and we have no clear idea what lossage 
might ensue if we change the behavior.

But if you want to move to an arrangement where `revert-buffer' focuses on 
synchronizing the buffer with the outside world, and people use a different 
command for resetting the modes, that sounds okay to me.  It would certainly 
resolve the one thing that I *do* feel pretty sure is a bug here, which is that 
reverting a buffer reverts the text-scaling too.  If someone increased the text 
size, they did so for purely visual purposes: it's so they can see the contents 
better.  Their eyesight doesn't change when they revert the buffer's contents, 
and clearly they know how to scale the size down again if they want to (since 
they scaled it up in the first place).

>Currently, the revert-buffer's C-u is used to choose between "revert
>from file or revert from the auto-save file".  Personally I never use
>that (probably the most obvious reason is that I don't use auto-save
>files at all), so I'd gladly change this C-u to mean "and reset the

I never use the "revert from auto-save" behavior either.  I'd be happy to have 
C-u mean "reset the modes" instead, but remember that would mean reversing the 
default behavior: instead of clobbering modes by default, it would preserve 
modes by default and clobber only on opt-in.

Even though Eli unconvinced me of that earlier, it turns out I'm weak-minded 
enough to have already fallen back into thinking it's a good idea now that you 
suggest it.  So I'm +1 on what you say, at least until Eli posts again?

Best regards,

reply via email to

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