unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Karl Fogel <kfogel@red-bean.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Should `revert-buffer' preserve text-scaling by default?
Date: Fri, 29 Nov 2019 15:02:58 -0600	[thread overview]
Message-ID: <877e3itmyl.fsf@red-bean.com> (raw)
In-Reply-To: <83pnhao1re.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 29 Nov 2019 22:39:49 +0200")

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	other threads:[~2019-11-29 21:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877e3itmyl.fsf@red-bean.com \
    --to=kfogel@red-bean.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).