From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61925: 30.0.50; normal-mode does not set up local variables in temporary buffers (scratch, with-temp-buffer) Date: Sat, 04 Mar 2023 12:19:31 +0200 Message-ID: <834jr0byz0.fsf@gnu.org> References: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14758"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61925@debbugs.gnu.org To: Wolfgang Scherer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 04 11:20:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pYP0A-0003de-8r for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Mar 2023 11:20:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYOzk-0007aP-VH; Sat, 04 Mar 2023 05:20:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYOzj-0007Zn-4a for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 05:20:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYOzi-00019j-Qq for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 05:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pYOzi-0004dg-7D for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 05:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Mar 2023 10:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61925 X-GNU-PR-Package: emacs Original-Received: via spool by 61925-submit@debbugs.gnu.org id=B61925.167792519617809 (code B ref 61925); Sat, 04 Mar 2023 10:20:02 +0000 Original-Received: (at 61925) by debbugs.gnu.org; 4 Mar 2023 10:19:56 +0000 Original-Received: from localhost ([127.0.0.1]:35270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYOzb-0004dA-GU for submit@debbugs.gnu.org; Sat, 04 Mar 2023 05:19:55 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYOzZ-0004cv-RA; Sat, 04 Mar 2023 05:19:54 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYOzT-000175-D5; Sat, 04 Mar 2023 05:19:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Lmf1PFScxtICtaO8WJjlXv5E5U0JWAZEDVTrObcRXwU=; b=ipJwqjIPNkaRd0AimMYJ LhoYvATk4Ylr/aBfIRZ0y8/gfTlYAEyeM6faREQPSl4EWy99TTWTl/Z8UDjwXn6nSbVdHqtKqx1il 09mEcNr6aSSVsUJ8bLHksXpi2Wzx39wiazpeubgZL8x8slLLCQx2TYkzwabg9uzWUKj32G04WUGjl GMXCihn2UcFV5gpS7Y79ooOsU+iINfiGZsop22ssqk8H4d83b+sK8E6wP3Y3LzPkcBj+jbgMot8Kk GXxj3gON3qP5TMEvhjCzEDLC+JCFyzhIDM/uwadF6O8vSE/swihn4LduY0wA7UKqTIurrCxPSvEBw GAriaxCW5YWSEg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYOzS-0004Zv-08; Sat, 04 Mar 2023 05:19:46 -0500 In-Reply-To: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> (message from Wolfgang Scherer on Fri, 3 Mar 2023 00:11:13 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:257265 Archived-At: tags 61925 notabug thanks > Date: Fri, 3 Mar 2023 00:11:13 +0100 > From: Wolfgang Scherer > > The command `normal-mode' does not set file local variables, if a > buffer does not have a `buffer-file-name'. This affects *scratch* and > buffers created using `with-temp-buffer'. > > The behavior changed at some time between Emacs version 20.5.2.2 and 20.6.3. > See output from various Emacs versions further below. > > If that was an intentional change, it should be prominently documented > to avoid the confusion when examples do not work in a *scratch* buffer. This was an intentional change, yes. And AFAICT, it _is_ documented in the ELisp Reference manual: -- Command: normal-mode &optional find-file This function establishes the proper major mode and buffer-local variable bindings for the current buffer. It calls ‘set-auto-mode’ (see below). As of Emacs 26.1, it no longer runs ‘hack-local-variables’, this now being done in ‘run-mode-hooks’ at the initialization of major modes (*note Mode Hooks::). And the documentation of run-mode-hooks says: -- Function: run-mode-hooks &rest hookvars Major modes should run their mode hook using this function. It is similar to ‘run-hooks’ (*note Hooks::), but it also runs ‘change-major-mode-after-body-hook’, ‘hack-local-variables’ (when the buffer is visiting a file) (*note File Local Variables::) ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The user manual indeed didn't mention this caveat; I've now mentioned that aspect there (and also in the doc strings of the relevant functions). (The change in Emacs 26 that caused this as a side effect was to fix bug#15577 and bug#23407.) > I would even recommend a warning prompt in normal-mode, when called > interactively. I think such a warning could be an annoyance.