emacs-devel
[Top][All Lists]
Advanced

[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: Fri, 29 Nov 2019 15:02:58 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On 29 Nov 2019, Eli Zaretskii wrote:
>There are other buffer-local minor modes that are of similar nature:
>display-line-numbers-mode, display-fill-column-indicator-mode, and
>maybe some others (e.g., what about hl-line-mode?).  So if we are
>going to preserve text-scale-mode across reverting, I think we should
>have a list of modes to preserve, not just exempt this one mode.

Good thinking; thanks, Eli.

So we would have a list variable `revert-buffer-preserved-modes', with a 
default value that includes:

  `text-scale-mode'
  `display-line-numbers-mode'
  `display-fill-column-indicator-mode'
  `hl-line-mode' (maybe?)
  ...maybe others...

Over time we can adjust the default contents of this list.

One minor implementation detail: some modes may have ancillary information they 
need to preserve along with the `foo-mode' boolean.  For example, 
`text-scale-mode' may need `text-scale-mode-amount' to be preserved: toggling 
`text-scale-mode' directly leaves that variable alone, so that the toggles jump 
between default text scale and whatever text scale one most recently set 
explicitly; however, `revert-buffer' causes `text-scale-mode-amount' to be 
reset back to 0.  I haven't dug into the code yet to see whether this was 
really a design decision or just an accident of implementation that can be 
fixed.  If it turns out that some modes need extra information preserved along 
with the mode variable, then the form of the proposed new list 
`revert-buffer-preserved-modes' might be a bit more complex than just a list of 
mode name symbols.  E.g., each element could be either a mode name symbol or a 
sublist, and in the latter case the first element of the sublist is the mode 
name symbol and any subsequent elements are mode-specific variables that need 
to be preserved.

Anyway, that's an implementation detail and can be figured out later.

In general, are you in favor of having a default list of preserved modes for 
`revert-buffer', with the above modes as the initial candidates for membership 
in that list?

Best regards,
-Karl



reply via email to

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