From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Should `revert-buffer' preserve text-scaling by default? Date: Fri, 29 Nov 2019 14:24:14 -0600 Message-ID: <87fti6toq7.fsf@red-bean.com> Reply-To: Karl Fogel Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="148296"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 29 21:25:53 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iampr-000cQt-SU for ged-emacs-devel@m.gmane.org; Fri, 29 Nov 2019 21:25:52 +0100 Original-Received: from localhost ([::1]:35016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iampo-0003w6-Ug for ged-emacs-devel@m.gmane.org; Fri, 29 Nov 2019 15:25:48 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42531) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iamp1-0003v8-7c for emacs-devel@gnu.org; Fri, 29 Nov 2019 15:25:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iamoy-0007h1-TC for emacs-devel@gnu.org; Fri, 29 Nov 2019 15:24:57 -0500 Original-Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]:33882) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iamoy-0007T2-FA for emacs-devel@gnu.org; Fri, 29 Nov 2019 15:24:56 -0500 Original-Received: by mail-oi1-x22a.google.com with SMTP id l136so11424542oig.1 for ; Fri, 29 Nov 2019 12:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:reply-to:message-id:user-agent :mime-version; bh=5aBA5h31AgZeFS2Zn6VMOCon2qtueR+/74cKQYKx7L8=; b=IdnqNfI9bwzPcFAOC+cab1XaxNRBS/VB9M9eDH1ReeSRRJaKzE97efq9CCEFq5/LJb pr6xLwxNbEKSJWUMdHgbeXYFsKGiikQrtF+jvYI5OaM+epHrKifdjZEc1yw6QpFW/9Xv hbrgi1IEFp1JWzC80d7+Rlyk3wJ/I18nf9kBLjGZkt7lPLSPpdE2lD8ssXKzIUSQKRP6 KCHnJlSQO4w95Rl9llsoWfo2b9mh1dDHugP2HnverNnncwfMnve9ZG3Z+TRI4WigSNGn OVsInyKMWkA4lF7ZOYt7NHenaxC3o3Ujzwv7d01YeUGEutj2UKpMmTyuYHxkIRtwrGW2 Ybbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:reply-to:message-id :user-agent:mime-version; bh=5aBA5h31AgZeFS2Zn6VMOCon2qtueR+/74cKQYKx7L8=; b=DCiVK+Z+iQxikAoy3ZRu7o/rStnK17xG3pGuEmumYu2zCIRxt20+mcUJmlLX+8tUff VCbc0paNg4toGkt6LAIG9/g4LksHNPSqv+gUUwBDdz3GHQptYKNBNmeCfr6f0Wo839WU E/32cgIQo6JoaAHam5ePhmR5JdLUHgPNsox2Iu/XufSaYiUpaRY1fgXc99h25d6KXoIs 0TCDvo7/gQnAF9oB6X3t/wZDkq6/4d79kxpYJVMRtEsp7SqzTv6HtblOlm7KOJ9E3NWl ekWRL0AwoIfr0MkmJHRxJHs1GiHaIjXFASFX8MHFcg7b9x+lCQbLknnEDxH3+wrTlaOf 2gBw== X-Gm-Message-State: APjAAAXY3XzMk1Zxf1lORULdXVjr7J21lPnBa7u4NoVqv2GHlvTpxbbE ltm5cMJcd+6u7mQXZF9y+cfOn/po X-Google-Smtp-Source: APXvYqwpnwTEeuNQ3L34+f7vkud/Lxfzxq49+R68tolf9waXecK8hSxNNELLVo0lHAh+LAUFjBQIFw== X-Received: by 2002:aca:39d7:: with SMTP id g206mr13154382oia.101.1575059090115; Fri, 29 Nov 2019 12:24:50 -0800 (PST) Original-Received: from floss ([2602:306:3707:da30:88:8959:f3b0:a36a]) by smtp.gmail.com with ESMTPSA id g5sm4340952otp.10.2019.11.29.12.24.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2019 12:24:49 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:242892 Archived-At: 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