From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 02 18:11:27 2023 Received: (at submit) by debbugs.gnu.org; 2 Mar 2023 23:11:27 +0000 Received: from localhost ([127.0.0.1]:59165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXs59-0005Qw-0W for submit@debbugs.gnu.org; Thu, 02 Mar 2023 18:11:27 -0500 Received: from lists.gnu.org ([209.51.188.17]:42938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXs56-0005Qo-UW for submit@debbugs.gnu.org; Thu, 02 Mar 2023 18:11:25 -0500 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 1pXs56-00035p-F6 for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2023 18:11:24 -0500 Received: from mout.gmx.net ([212.227.17.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXs53-0003Ix-QO for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2023 18:11:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1677798676; i=wolfgang.scherer@gmx.de; bh=NFGbOiWAHmPm2R+KmRn5H+5Ui81LmTU9hzxsg+iUfwE=; h=X-UI-Sender-Class:Date:To:Subject:From; b=NfzYHRCbjbe6I7trcigxP/POpH4bgEDqCARNHh3MA56ipK/nywWTL1Y+7uaXwzuOp jKARCfhNUV0z1JOIg3FBtI3LxmMy7ujZNqd+UKcYbOrtl3za9489De5005PtK6gtO8 GilWqnMdA4X433ajs2mowUNZnmQsAZRiqfC/c1qizdO0njWc8EDT6YogFusMluufpj L31Vqeefs6Sfu6aZ+lhaGJD7w2IsHusQwKIRjGvQAUwXmkS4K03kUowAr5QwkdebFi kiTdC+4bYxDI99UhpPtAqqZcSHCtViYRAAf8fl+kJvxGpeMkpzKdEpT2/pOZBQCovp a+FWFPWSaVV4w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from sheckley.simul.de ([87.144.32.75]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MvK0X-1qObBt0rj7-00rH0V for ; Fri, 03 Mar 2023 00:11:16 +0100 Received: from [192.168.33.23] (franke.simul.de [192.168.33.23]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by sheckley.simul.de (Postfix) with ESMTPSA id 85794194014D for ; Fri, 3 Mar 2023 00:11:13 +0100 (CET) Message-ID: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> Date: Fri, 3 Mar 2023 00:11:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 To: bug-gnu-emacs@gnu.org Subject: 30.0.50; normal-mode does not set up local variables in temporary buffers (scratch, with-temp-buffer) Content-Language: de-DE From: Wolfgang Scherer Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:Xu9vuyPXWDUqAX1kNMwzDXPJl9CSnNJ0GWguKlUXaQH0N/gYwy5 KctesUW6Gd5Du3Oew4Bv4ew3TYrQJjd9ONQaxbKPsJofKcNn8HFoxiUJiRxqtgUev23Y26Z QqwDOY8GYwYgSZ5uzMHCYFDKH+kPOVkjFw6bOo25o43qQe167OEvwSvFpYlOCk7ebAU5O2Q IqQDhhYWuREsbAvDazYkA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:nOu1H+Zgfz8=;0Ok/ZJ3v7b00XjoeYrqmjkiGySL +EFTfwCXdnXAmULCQXyqne0Jnd82gLx7TIzPIPMrMGcy5QllaKHiJkJYLE7HYjAo1o670fHyp nSjjbB5OZMSTO62HRPtR9Ve4qM1+Ekoe/jwQkBmE8+TYkVuSGs9nd4DxnRHb51ahIvHJNTBK1 li8qPzEugnCTDos3Bm9aHw0jayGi/rfT2Syl9IQk1L8f8HiavpLvr/wFsqCJeGdOfvWVPnOJa g6ndHRObjleYt8Es3ZkG0pZjh0T0lHcfJPdZ1yqdeTZUHj70pNcLteQUcvxAEAnmgSfp0RSJP f/9P/cBj3pu9MX+93a5veLA8bqGJo8Il9jnub01LJBHi6BpHKUhBQFWGJZk4p+1n00YTS1e8G sI+oAxz7hQTs8GsMcaZ9vhO8LDRDaWQvBJebisWp7q7CurEPK8qMp8DgFWMMmCx9GklRC0cVB AWEE4HQrJYyOxX2as+lsGjfENztsGlU0nazzletqmsqmHlxo6zetM+NBCK9sOYSdD/9VqUj+8 PfZXrcM0pH+8xrngLNXZmIVCy2K00Q0MjnaAyjsmWhmqG6loYNpxuVhrZBcgX/tGYbYCklsAM Oydav95lnJ3VxMOJcHfKiDnOXHcpzWqMinH4Sc821OT2zT3CL26Nj3dH9eoBsO1rS2ca5wzXK Xq7Egof0shr7LUaOr1UMU8nuCWM3cHo0mWcdVRSutbashyKGsibawtmxVdoUlFw/95AMzQAMG y2K5+6+Ybqq/uWAmKeTsDIbZ4Rylw4BQd0obtQfyFd09+HWcM+WLbstOFmpLOf68vc8AqUOXi 4fimomv0ukS5Oyqe4cf/7oV3AYz+mT7oR8/MbWq0a4i7jZFyDcYiazTO8/SWRgzqQanTqorrX xmPbARWJuAdgZNu42HAj2fcJwWvJaeWy+zZh7WyA8caydmAVYRr3w1WpLF4sFpVXoWanMl3Vb r8MNSg== Received-SPF: pass client-ip=212.227.17.22; envelope-from=Wolfgang.Scherer@gmx.de; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) 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. I would even recommend a warning prompt in normal-mode, when called interactively. After executing the the test expression (let ((expected-value (not (default-value 'truncate-lines))) sep) (princ "# |:sec:| local variables test\n") (dolist (fn (list nil "fake-file-name")) (with-temp-buffer (insert (format (concat ";; -*-" " mode: fundamental;" " truncate-lines: %S;" " -*-") expected-value)) (let ((buffer-file-name fn)) (normal-mode) (princ (format (concat sep ".. code-block:: elisp\n" "\n" " ;; emacs-version: %s\n" " ;; buffer-file-name: %S\n" " ;; truncate-lines: %S\n" " ;; expected-value: %S\n") emacs-version buffer-file-name expected-value truncate-lines)))) (setq sep "\n")) (princ "# |:sec:| local variables test\n")) the following output is shown in the *Message* buffer: # |:sec:| local variables test .. code-block:: elisp ;; emacs-version: 30.0.50 ;; buffer-file-name: nil ;; truncate-lines: t ;; expected-value: nil .. code-block:: elisp ;; emacs-version: 30.0.50 ;; buffer-file-name: "fake-file-name" ;; truncate-lines: t ;; expected-value: t # |:sec:| local variables test Here is the output from various Emacs versions, I have access to: # |:sec:| local variables test .. code-block:: elisp ;; emacs-version: 22.1.1 ;; buffer-file-name: nil ;; truncate-lines: t ;; expected-value: t .. code-block:: elisp ;; emacs-version: 22.1.1 ;; buffer-file-name: "fake-file-name" ;; truncate-lines: t ;; expected-value: t # |:sec:| local variables test # |:sec:| local variables test .. code-block:: elisp ;; emacs-version: 24.3.1 ;; buffer-file-name: nil ;; truncate-lines: t ;; expected-value: t .. code-block:: elisp ;; emacs-version: 24.3.1 ;; buffer-file-name: "fake-file-name" ;; truncate-lines: t ;; expected-value: t # |:sec:| local variables test # |:sec:| local variables test .. code-block:: elisp ;; emacs-version: 24.5.1 ;; buffer-file-name: nil ;; truncate-lines: t ;; expected-value: t .. code-block:: elisp ;; emacs-version: 24.5.1 ;; buffer-file-name: "fake-file-name" ;; truncate-lines: t ;; expected-value: t # |:sec:| local variables test # |:sec:| local variables test .. code-block:: elisp ;; emacs-version: 25.2.2 ;; buffer-file-name: nil ;; truncate-lines: t ;; expected-value: t .. code-block:: elisp ;; emacs-version: 25.2.2 ;; buffer-file-name: "fake-file-name" ;; truncate-lines: t ;; expected-value: t # |:sec:| local variables test # |:sec:| local variables test .. code-block:: elisp ;; emacs-version: 26.3 ;; buffer-file-name: nil ;; truncate-lines: t ;; expected-value: nil .. code-block:: elisp ;; emacs-version: 26.3 ;; buffer-file-name: "fake-file-name" ;; truncate-lines: t ;; expected-value: t # |:sec:| local variables test # |:sec:| local variables test .. code-block:: elisp ;; emacs-version: 27.1 ;; buffer-file-name: nil ;; truncate-lines: t ;; expected-value: nil .. code-block:: elisp ;; emacs-version: 27.1 ;; buffer-file-name: "fake-file-name" ;; truncate-lines: t ;; expected-value: t # |:sec:| local variables test In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-03-02 built on franke Repository revision: 828c49ae29fd318547d7bbe4e7fdc65da316e309 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Ubuntu 22.04.1 LTS Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LANG: de_DE.UTF-8 locale-coding-system: utf-8-unix Major mode: Messages Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-mode novice display-line-numbers time-date subr-x cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 50622 7192) (symbols 48 6822 0) (strings 32 16418 2244) (string-bytes 1 443040) (vectors 16 9557) (vector-slots 8 153161 11625) (floats 8 39 119) (intervals 56 747 136) (buffers 976 13)) From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 04 05:19:55 2023 Received: (at 61925) by debbugs.gnu.org; 4 Mar 2023 10:19:56 +0000 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 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 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==; 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 Date: Sat, 04 Mar 2023 12:19:31 +0200 Message-Id: <834jr0byz0.fsf@gnu.org> From: Eli Zaretskii To: Wolfgang Scherer In-Reply-To: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> (message from Wolfgang Scherer on Fri, 3 Mar 2023 00:11:13 +0100) Subject: Re: bug#61925: 30.0.50; normal-mode does not set up local variables in temporary buffers (scratch, with-temp-buffer) References: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61925 Cc: 61925@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 04 23:58:26 2023 Received: (at 61925) by debbugs.gnu.org; 5 Mar 2023 04:58:26 +0000 Received: from localhost ([127.0.0.1]:38196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYgS2-0000rR-41 for submit@debbugs.gnu.org; Sat, 04 Mar 2023 23:58:26 -0500 Received: from mout.gmx.net ([212.227.15.19]:57485) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYgRu-0000r1-VL for 61925@debbugs.gnu.org; Sat, 04 Mar 2023 23:58:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1677992292; i=wolfgang.scherer@gmx.de; bh=RWGqus0/Eb12C92NuXASQMTPTR/MOGop9aprmmCEwMI=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=iIS5OLWPY0DEVZyYX6dQuNgtdTi/X407HnmM2YY+KMYNemqG0hnE72J4v+AiHk5+B u6aSAzhL4nAAbu3PjBzV6c8KIcYL++st26X/sHA/dbWhY/sAM2bz9NDvayD2Y9Jf0A 7MvTcoBq++TfigVg8boh+k8Pp15DEx/xXSaKjmP9SVSPQzTEwXK7PtCwwge2llnzWZ hROXp0uJkK8nQ6izwtCzONnMvacZHbebSsmZ1JaXPNGfJ/TZsf0W/w3/lFJG+0nvpL CVHz9S9S9iIKPIYiwWpliZMYh2PEluA5K0E2bmSvEQHg0bthSuavJ/pREf2XIm9oda iN1CbH+qpgJDA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from sheckley.simul.de ([87.144.32.75]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MrQEn-1qKvpL1THj-00oSWa; Sun, 05 Mar 2023 05:58:12 +0100 Received: from [192.168.33.23] (franke.simul.de [192.168.33.23]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by sheckley.simul.de (Postfix) with ESMTPSA id 5973119405DC; Sun, 5 Mar 2023 05:58:09 +0100 (CET) Message-ID: <31009265-77c5-0cc6-30ab-30c4209fe5e5@gmx.de> Date: Sun, 5 Mar 2023 05:58:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: bug#61925: 30.0.50; normal-mode does not set up local variables in temporary buffers (scratch, with-temp-buffer) Content-Language: de-DE, en-US To: Eli Zaretskii References: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> <834jr0byz0.fsf@gnu.org> From: Wolfgang Scherer In-Reply-To: <834jr0byz0.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:O7SI1rKT/P27MAgZciOey+x4rFQkkHl1LQmqcXiXdWbug0qTv6i LoEk82d0gZ9H2y1CJ346mss9KEi80S8HRNu/LGTZe1FsUlO4dGsQ7Fy+xI5Xi/Aou4SlUFQ UcEv8JpysITnK7nwfurzRbItm6kTatHeC+mKMW5jieEpUfMaFJw1WHVgqqLbWpDxd5XrAjl g4Oh9WpOjUz/duJ7RUmpw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:VVuJFBBtNTg=;5nzPUIxfqdT+rLSPD7opitLT0i7 svTTmvd9tJPbccQ6mflrERAbEmAIWVDQicWiCcvBPD44XX/fY9AiuYl/SAuq/65YnnD8rY3iW H7GhtnnPUTutXzNx8LW6HV2QPG2nuClTOjV9jUCTpy8VAKl3bHnCcrnQWhZhads7icXAjlvmS y196qbg2QiCGBmpdR1OmwSYJ0HEtTcjJyPL2D5Kb2t35JlaiGtq/pMvFkeSSHw+21h0vHvvOn rrEfDhJ56QCNmUjxL3Kbka0MAzhzakW5G7KH0evnBHgpgWGkI1P5olLWukDoEAzXahj+K+sUc MygTIGPeLKkzyKQRq69XyFNoQMCesbxUV/lrfnfx1rAcd+7pXwXn2Z38BDBySAobfAHxLQ0S3 LR3+h6NT6mvl4T80WMamfadYalVgbq07r/incg5FunSD1KLs3vgc1JU4WlY3RFGFJjRtRNpxm LhBx4obWiblGDdDTNIePv7LrPysHOuDOQfgLfMB7fyFYG0sOeg11J2sbGwKZ5J1vSHvj1FEB3 JQnDaoVm+UNDhFII2KNtm51RuKb2lR3Nxe9F+YNY+6wX9ilD3s28cXigalH6gRr2WGXAeT37o /kHhgFBU8LHd7XF4276Ixh3lgLNj/mEEaJGoDZEApfsQxGbYhzJxvByqEvYHhibmM1BzVUeCA 0YzWID0BggzQvNaBkTivHuLenSZAjc9X8DMqcixkVWYSW3ROfoC5Qxd5UF/6QOZXp+tEEi1gc R77j2LoX/1eDItfn4u3uHDA3EXeklOKCgh5eUe8gMVgw5AVvYIGKmX2V+EunDOgsahVW6ab3e zj7qQLqKI3EEJ1zE3dTp/lIHpQSSdbPYgJN05llaHCR6+XW65Ckmknv+V1gk3IhkPZC/fvdkq FrfSQZSV4wgip9kKs/mnJYimV/7qvCqftHsdherLBgZUC5/IcLYccb3okOw7J6LxZYgrzOaQM WGwxbIcjmH+uaZkS4KBTx/aysvw= X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 61925 Cc: 61925@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) > 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. Alright, in this case, I would like to publish an advice which restores the previous behavior for anybody running into the same problem: (let* ((expected-value (not (default-value 'truncate-lines))) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (need-advice (with-temp-buffer =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (insert (format (co= ncat ";; -*-" =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 " mode: fudamental-= mode;" =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 " truncate-lines: %= S;" =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 " -*-") =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 expected-value)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (normal-mode) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (not (eq truncate-l= ines expected-value))))) =C2=A0 (when need-advice =C2=A0=C2=A0=C2=A0 (defadvice normal-mode (around wsx-normal-mode activat= e) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "Bind buffer-file-name to `null-device', i= f it is nil." =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let ((buffer-file-name (or buffer-file-na= me null-device "/dev/null"))) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ad-do-it)))) > 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 =E2=80=98set-a= uto-mode=E2=80=99 > (see below). As of Emacs 26.1, it no longer runs > =E2=80=98hack-local-variables=E2=80=99, this now being done in =E2= =80=98run-mode-hooks=E2=80=99 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 =E2=80=98run-hooks=E2=80=99 (*note Hooks::), but it als= o runs > =E2=80=98change-major-mode-after-body-hook=E2=80=99, =E2=80=98hack= -local-variables=E2=80=99 (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. It most definitely should be, to get the proper attention. It could be disabled by setting a customized variable, pretty much the same way as risky local variables can be enabled with custom settings. That would reduce the annoyance to once in a session or once in a lifetime. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 05 00:04:04 2023 Received: (at 61925) by debbugs.gnu.org; 5 Mar 2023 05:04:04 +0000 Received: from localhost ([127.0.0.1]:38200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYgXU-00012D-7J for submit@debbugs.gnu.org; Sun, 05 Mar 2023 00:04:04 -0500 Received: from mout.gmx.net ([212.227.15.18]:45975) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYgXS-00011k-Ks for 61925@debbugs.gnu.org; Sun, 05 Mar 2023 00:04:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1677992635; i=wolfgang.scherer@gmx.de; bh=4sH02E4ViSwHEaIcWi8aLp/W5aPcq7qojj3FvRjX15M=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=sCL1JND2FEnaqg56INdaK4DCG5aaXOQXayhw/U/cVE0OnE2yipx4AsOS3qmEhM62U 7eN+ScTcjYhSJejwVNfBTFvG3MdX6bfLCi/wAVyqya/HCwc6sKFK0IdWI1IaAWTMij TCIfAs/G5pwMqu7uxUd65KqQjVSw+hab74Pmz0j8KOaO3V2F/c5EH3ikNlJNL/xwyw C7udfTRwCZP+9GHa+RqyiEYpgQ3WyziQX2cwEnJ+NrNdxmEjT6H3+4wFQ/EuceIadV T4EfZdjkdnVu/0cTxltVy4yLtxal/Tx3jJ5f3WoJqQKx5gr11KDg0M9gbxCCAf8Gc7 LN4gheMHsuosQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from sheckley.simul.de ([87.144.32.75]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MKKZ3-1psI1F3RGR-00LpJD; Sun, 05 Mar 2023 06:03:54 +0100 Received: from [192.168.33.23] (franke.simul.de [192.168.33.23]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by sheckley.simul.de (Postfix) with ESMTPSA id EA3D919405DC; Sun, 5 Mar 2023 06:03:53 +0100 (CET) Message-ID: Date: Sun, 5 Mar 2023 06:03:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: bug#61925: 30.0.50; normal-mode does not set up local variables in temporary buffers (scratch, with-temp-buffer) Content-Language: de-DE To: Eli Zaretskii References: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> <834jr0byz0.fsf@gnu.org> From: Wolfgang Scherer In-Reply-To: <834jr0byz0.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:VIVqHtfMQkxtQbMPOv3ZRyHTJ2gcEjUJZk93EB2nPmg4Zq1rMlC vjtJRHI2XZhQA/QA8YcuOVW0NC7p4+gR5sJLhVE18Ho5isX5KFKFn2gxqD7cWTjKPmGGJVZ 1ucRxK7WDxaLRoYKotU1VPA6vuK/nvvPCYBFXdri+W9iNgItJAa+wYncLYRX8kbQ6BFGDGH sMi+ganNauO43JTnw0yTw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:UZLtdyW6Y9E=;UX3DEnT6haEOIba6bCcUh8f7lIJ 7pM3wibUKnrU/aY4BSr0siEpHKhz0Z7ATB6nulpZ31NXO9R3KA1goD2NYClJcy7Uk9IXk5XgZ C8KOn1Peye7KbawleRGtoHlCQklmpSqzMAEEq+QuhYU3XfEklWs05ahn7mZPO3dUmLOKNd7Rt ZiTFkvpLTLTsY1qISNpwJ1DcBms3iXutwBbi8BPGY8CNcv+XonF4VWJgxwJildd8yV2ln+qBo aPQkkjuIQ0g04gMf0AzaeodPAaQdPSvI70qE46/+GHcNktng0u620EI4q7Ym2MlBvzvox8T7W NbWhS9X8/Vp9LY9GnpdufMhVCjPMcoqFAyrJL0dyR2R+PD0jwge5ARw2jwaWsZdv4wljy08wZ ALlwbaZ/aGG/CYSq5N6nkjX+Y1ur9uziBfUDRParlhvSmqzYUnBvuXRfMxJyOQHtJot7goJ4t qjh+jQ2b2LrYfNX7KXqK31KtYWioLyQ9M1pdKETZPCk7NdHo9xMaAz/pr40c14tqPShIFg+Q8 mvLpU3nQWBCBl08C4rppWjIuPGpSaRmb3Q8+7h/+se4GTWLHLUv14T+EZ1qMcm9XtOOeJIU9/ xGjtcPcPfNwn651oHFnLrjuH52h/kOR9iXm3NGSa8CJy5zJPl2KRIwtcBSw2MxWrGRz2mYDsk WZEVR0PQ1kI/zSNui/xc4hDhrJBU+O/hYGZ6yxDPsUbB4u9rqBspRUhUrbqwxR5AuJYQBuMzr iHiVQigO9NntoIgDB4aZePQNRGkl58qKdEzLAHKT7QK19VOhw6hIi9GO9wpVgd/7xITs9nzfL FVxnTM//MfYiOEIPan+AhDtaKTavjtiqLNuwMcQSE8wFkG4NNdYRe33BS57fR1M5OseTy/x6v oW2c9zDgxhznyIJ00PeOFBRbU1yDkH7/gBHK52CbKzdioAP/1IE/infJEXFxeZ9tnVxOZPUJt Ol5vB3VJ7cF04fRIP+kEFEEcyoI= X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 61925 Cc: 61925@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) > 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 =E2=80=98set-a= uto-mode=E2=80=99 > (see below). As of Emacs 26.1, it no longer runs > =E2=80=98hack-local-variables=E2=80=99, this now being done in =E2= =80=98run-mode-hooks=E2=80=99 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 =E2=80=98run-hooks=E2=80=99 (*note Hooks::), but it als= o runs > =E2=80=98change-major-mode-after-body-hook=E2=80=99, =E2=80=98hack= -local-variables=E2=80=99 (when > the buffer is visiting a file) (*note File Local Variables::) ^^^= ^ > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Just for your information, the machinery in `normal-mode' and `run-mode-hooks' is -- at least in some edge cases -- out of sync. Here is a case, where normal-mode in Emacs > 26.1 still calls `hack-local-variables', which causes a discrepancy, depending on `delay-mode-hooks', when `after-change-major-mode-hook' alters the value of a local variable, which is also set in the local variables list. The reason is, that in `normal-mode' `after-change-major-mode-hook' is not called the same way as it is in `run-mode-hooks'. ;; for all cases: `after-change-major-mode-hook' establishes local ;; variable and sets the value to "hello" ;; case 1:=C2=A0 buffer with `buffer-file-name' =3D=3D nil, `delay-mode-ho= oks' case 1.1: nil, case 1.2: t (check-normal-mode-in-temp-buffer nil nil nil t=C2=A0 ) ::go:: ;; =3D> hel= lo (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 nil nil t=C2=A0 ) ::go:: ;= ; =3D> good-bye ;; case 2: buffer with `buffer-file-name' not nil, `delay-mode-hooks' case= 2.1: nil, case 2.2: t (check-normal-mode-in-temp-buffer nil t=C2=A0=C2=A0 nil t=C2=A0 ) ::go:: ;= ; =3D> hello (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 t=C2=A0=C2=A0 nil t=C2=A0 = ) ::go:: ;; =3D> good-bye The following is the complete test setup that I used for testing: (defun check-normal-mode (&optional set-delay-mode-hooks set-buffer-file-n= ame find-file) =C2=A0 (interactive) =C2=A0 (let ((buffer-file-name (or buffer-file-name (and set-buffer-file-= name (or null-device "/dev/null")))) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (delay-mode-hooks (if set-dela= y-mode-hooks t))) =C2=A0=C2=A0=C2=A0 (normal-mode find-file))) (defun check-normal-mode-in-temp-buffer (set-delay-mode-hooks set-buffer-f= ile-name change-hook after-hook) =C2=A0 (let ((hook-function #'(lambda () (make-local-variable 'wsx-here-i= -am) (setq wsx-here-i-am "hello")))) =C2=A0=C2=A0=C2=A0 (if change-hook =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (add-hook 'change-major-mode-a= fter-body-hook hook-function) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (remove-hook 'change-major-mode-after-body= -hook hook-function)) =C2=A0=C2=A0=C2=A0 (if after-hook =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (add-hook 'after-change-major-= mode-hook hook-function) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (remove-hook 'after-change-major-mode-hook= hook-function)) =C2=A0=C2=A0=C2=A0 (put 'wsx-here-i-am 'safe-local-variable 'string-or-nu= ll-p) =C2=A0=C2=A0=C2=A0 (with-temp-buffer =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (insert ";; -*- mode: lisp-interaction; tr= uncate-lines: t; wsx-here-i-am: \"good bye\"; -*-\n") =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (normal-mode) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (check-normal-mode set-delay-mode-hooks se= t-buffer-file-name) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (describe-variable 'wsx-here-i-am) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ) =C2=A0=C2=A0=C2=A0 (remove-hook 'change-major-mode-after-body-hook hook-f= unction) =C2=A0=C2=A0=C2=A0 (remove-hook 'after-change-major-mode-hook hook-functi= on) =C2=A0=C2=A0=C2=A0 (put 'wsx-here-i-am 'safe-local-variable nil))) ;; Emacs >=3D 26.1 (check-normal-mode-in-temp-buffer nil nil nil nil) ::go:: ;; =3D> void (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 nil nil nil) ::go:: ;; =3D= > good-bye (check-normal-mode-in-temp-buffer nil t=C2=A0=C2=A0 nil nil) ::go:: ;; =3D= > good-bye (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 t=C2=A0=C2=A0 nil nil) ::g= o:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer nil nil t=C2=A0=C2=A0 nil) ::go:: ;; =3D= > hello (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 nil t=C2=A0=C2=A0 nil) ::g= o:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer nil t=C2=A0=C2=A0 t=C2=A0=C2=A0 nil) ::g= o:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 t=C2=A0=C2=A0 t=C2=A0=C2= =A0 nil) ::go:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer nil nil nil t=C2=A0 ) ::go:: ;; =3D> hel= lo (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 nil nil t=C2=A0 ) ::go:: ;= ; =3D> good-bye (check-normal-mode-in-temp-buffer nil t=C2=A0=C2=A0 nil t=C2=A0 ) ::go:: ;= ; =3D> hello (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 t=C2=A0=C2=A0 nil t=C2=A0 = ) ::go:: ;; =3D> good-bye ;; Emacs < 26.1 (check-normal-mode-in-temp-buffer nil nil nil nil) ::go:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 nil nil nil) ::go:: ;; =3D= > good-bye (check-normal-mode-in-temp-buffer nil t=C2=A0=C2=A0 nil nil) ::go:: ;; =3D= > good-bye (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 t=C2=A0=C2=A0 nil nil) ::g= o:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer nil nil t=C2=A0=C2=A0 nil) ::go:: ;; =3D= > good-bye (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 nil t=C2=A0=C2=A0 nil) ::g= o:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer nil t=C2=A0=C2=A0 t=C2=A0=C2=A0 nil) ::g= o:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 t=C2=A0=C2=A0 t=C2=A0=C2= =A0 nil) ::go:: ;; =3D> good-bye (check-normal-mode-in-temp-buffer nil nil nil t=C2=A0 ) ::go:: ;; =3D> goo= d-bye (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 nil nil t=C2=A0 ) ::go:: ;= ; =3D> good-bye (check-normal-mode-in-temp-buffer nil t=C2=A0=C2=A0 nil t=C2=A0 ) ::go:: ;= ; =3D> good-bye (check-normal-mode-in-temp-buffer t=C2=A0=C2=A0 t=C2=A0=C2=A0 nil t=C2=A0 = ) ::go:: ;; =3D> good-bye From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 05 21:08:06 2023 Received: (at 61925) by debbugs.gnu.org; 6 Mar 2023 02:08:06 +0000 Received: from localhost ([127.0.0.1]:41015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZ0Gk-0002SC-DW for submit@debbugs.gnu.org; Sun, 05 Mar 2023 21:08:06 -0500 Received: from mout.gmx.net ([212.227.15.18]:47779) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZ0Gj-0002Rj-1u for 61925@debbugs.gnu.org; Sun, 05 Mar 2023 21:08:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1678068479; i=wolfgang.scherer@gmx.de; bh=ZSEvlMbKUaPm5GvcB0d5QQyNnesGJEtUyyg4AlmSxP4=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=ghCNQqCR+Kr0PEfPsB485k+BJU8AR5vqPjkraGfQseQA0ClekASfkt731hM39rpCa SAYZPKsLJNV1SMh33kbob3XwxyEqZrmZFFEuO/uwNkTQ247OxMABivKipfmRdpeV3M i0uiKHpIq8yqiMV+SQfe8uzChZWOR3kWZXINXAEKiuKmWOs8mj3YnWESwErxW7O3pn BnVilDnvir5nEDNXEF98kgndFV0TxRKXchwC5yli5wtwpC8qQw57SmhS//4hAL3tnl TTN/1TEiYl0JG5yVOT2rOMM8Rt9diLLttq+25512kB5mjP+VTe0Wc4EkoNj3A7NAJs 2XQGUOhkmTzqQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from sheckley.simul.de ([87.144.32.75]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mnps0-1qOKN23sCI-00pIgE for <61925@debbugs.gnu.org>; Mon, 06 Mar 2023 03:07:58 +0100 Received: from [192.168.33.23] (franke.simul.de [192.168.33.23]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by sheckley.simul.de (Postfix) with ESMTPSA id 450FD19405DC for <61925@debbugs.gnu.org>; Mon, 6 Mar 2023 03:07:58 +0100 (CET) Message-ID: <3cb3e78e-440d-81d6-264f-c6c3cf94c854@gmx.de> Date: Mon, 6 Mar 2023 03:07:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: bug#61925: 30.0.50; normal-mode does not set up local variables in temporary buffers (scratch, with-temp-buffer) Content-Language: de-DE To: 61925@debbugs.gnu.org References: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> <834jr0byz0.fsf@gnu.org> From: Wolfgang Scherer In-Reply-To: <834jr0byz0.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:Jw4rs0xR9qCY8q/2Phv80BGRxIahOgpiyRC12oDZN7n0Tk337vd JpibJGqWBLyxImuSyEWwq/VpRBVo0c5xyqx3kELwJfAo2GYFAH1o66QDpNzhrRXWvSKMCZE l4o0g6O1YM6Rd3PoFhQx9CcdpPq7KCu59riC4pcVPRvBLYRgqgX9yPCBT+UtrpeBY+WgfZd kG638evR9KYfNc+zDDDyQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:lcVDaNqfuAA=;y7lr8JbAxtrFqcvdex113UqQYe0 m5YrmfVf2nDVr8YwsH5jptHNg27n6fDm9EPgjek7DQegs8SH19QqK2WQpEC+X/LXo2Ajouudg ESs4ef3/piJdEPT6GYt3OBUQkJpLCh0+k12MNwlNoAvY6z7cQ1ZJZDyLWYBDlmllwuxEs/bTl lOfomzwzpyPhZe4Vt/+t9oFsh5fjOv6ektVemhAGrEbGy7GZWrJDawE1P7X7f52k0mFHm8a5n 5T1CrvTGdi2JU3z4AhkT4OGR6gVqEsg44DqXHLzuwbtPAnG18tljPBGy0QNqp7rHEtV8rK2Dz E2zaxaq12GyeP/+Hp7wDQ/amU4Obzx9O26oMHZyFCYZmhOoxFNLsdKm9zkyzRmlv55r59+7ox 5MtEORsSZ6aHz72su6U/1z6ayl0OERqQFOOiF+XKAXhTNslR6/j3859RD/kF22xM/XnWy5XbK MbilYhjMz0pVLpvw1h+gIVyMKKW12kI49KhiwDBVnJWEhfQElI3C0tCez8YKpF1Rw7DNde8zT ypLXPtNoWhPlAjgFZCi2K/huHGsUN8fia+b2OUVWoCOSb7ux47sJECanFiFLupkLT186Zdct5 v+DBngeFIDYNgwkcqK9u3O7HGidF/jeH01VxRY3/XeapJLXSBCMAxAujFsCQUi8l0yLpIQztI 7ijItyJZbDrczJNP5Q9zlEKrgkL0yZbPJKGbFzZGL8Oc6UKLXqx9ikwQ+MQCTMI0P1Vx9eShz zRjGh1lJRg8mNEAvjR91dh+c7thpz3JBhJ9Sgvh41l97u7xN9VYbl3EsF1K3JhRwSdB1+NMqe nQ2Uo9RCo7tSAZdgodqtx4yVg+muAyW594Ex1swjgOsBQDaU5+i1IkeXACIjreA5gdJ/9ZQLW 9yaoBJtWwjaRHorhma0OUz0e/2LNKaXaZS3/JI946n21PLTKTOPkyara2UTHg5A//ZYdCrW3F laMPoWHjcPJ1sChFKfa/xZMazC4= X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 61925 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) VGhlIGNvcnJlY3RlZCB2ZXJzaW9uIG9mIHRoZSBhZHZpY2UgZml4ZXMgdGhlIGludmFsaWQgbW9k ZSBzcGVjaWZpY2F0aW9uLg0KDQoobGV0KiAoKGV4cGVjdGVkLXZhbHVlIChub3QgKGRlZmF1bHQt dmFsdWUgJ3RydW5jYXRlLWxpbmVzKSkpDQoNCiDCoMKgwqDCoMKgwqAgKG5lZWQtYWR2aWNlICh3 aXRoLXRlbXAtYnVmZmVyDQogwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgIChpbnNlcnQgKGZvcm1hdCAoY29uY2F0ICI7OyAtKi0iDQogwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgICIgbW9kZTogZnVuZGFtZW50YWw7Ig0KIMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoCAiIHRydW5jYXRlLWxpbmVzOiAlUzsiDQogwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgICIgLSotIikNCiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBleHBlY3RlZC12 YWx1ZSkpDQogwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChub3Jt YWwtbW9kZSkNCiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKG5v dCAoZXEgdHJ1bmNhdGUtbGluZXMgZXhwZWN0ZWQtdmFsdWUpKSkpKQ0KIMKgICh3aGVuIG5lZWQt YWR2aWNlDQogwqDCoMKgIChkZWZhZHZpY2Ugbm9ybWFsLW1vZGUgKGFyb3VuZCB3c3gtbm9ybWFs LW1vZGUgYWN0aXZhdGUpDQogwqDCoMKgwqDCoCAiQmluZCBidWZmZXItZmlsZS1uYW1lIHRvIGBu dWxsLWRldmljZScsIGlmIGl0IGlzIG5pbC4iDQogwqDCoMKgwqDCoCAobGV0ICgoYnVmZmVyLWZp bGUtbmFtZSAob3IgYnVmZmVyLWZpbGUtbmFtZSBudWxsLWRldmljZSAiL2Rldi9udWxsIikpKQ0K IMKgwqDCoMKgwqDCoMKgIGFkLWRvLWl0KSkpKQ0KDQo= From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 10 06:08:19 2024 Received: (at 61925-done) by debbugs.gnu.org; 10 Jan 2024 11:08:19 +0000 Received: from localhost ([127.0.0.1]:42175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNWRW-000897-L5 for submit@debbugs.gnu.org; Wed, 10 Jan 2024 06:08:19 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:57520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNWRT-00088t-VI for 61925-done@debbugs.gnu.org; Wed, 10 Jan 2024 06:08:17 -0500 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-557dcb0f870so2880227a12.2 for <61925-done@debbugs.gnu.org>; Wed, 10 Jan 2024 03:08:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704884883; x=1705489683; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=gjETzhE/5a89r2hP9va4qropFJEwGLB36ztBhv3RiT0=; b=T2uW3wLhYR4ow8PE2Nhwb4E4y36f7jcKE54YcyfWhW5ilbsyPBesPiG/yrfRbNaYQA 0PtzZDURDdmEwqBFQndbIyfqUppm7zAQbHp8VzDZi5YiZqd76AXRL0upQy+4PL39HfxI /+k/or5ROSzFqlfNSTTIGClqkfN6pZJDry6pWR1CjhZky/IUK+ggj9xUbchxDbt0RLxs +76VjGZ9OuF00Ui2O0TTqqjwZ0YIadYWyZD6RRInoP0jfqPi85ybPIWVyzfrnOStz971 fb8nInyHLNqvockgQoHtoVh0q0o/8h67hkiJVUdwvqiiAnXMOmqbLl0+T8d+1eNum9WB uJvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704884883; x=1705489683; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=gjETzhE/5a89r2hP9va4qropFJEwGLB36ztBhv3RiT0=; b=JwlEKqViEWAKbn39iK2VcGATo5+LAVJrdhyQgOYx2Pvie2vkQUpeyKXcPI3e0Qkrkb jBjpqVA/54b6l9bZwgZ3xZWf27REufMnj+65ToZ/818a06Ev6hLoJhvTj+kIQ4WguuDf u2dHXU+lnqiKjUfUksRYkT4prGsVD/YVVD8dOwBqdqlsUC06F5RegUWUbu8fukInNr7Y jrvO47ndckEzXM7n6y6qQENe4THDRKYNJKjrclYZpW5ChA/qv2ld307PLfkN84yWnCNV f1QMUhfZ3Q7FFtyBdjoJxDW6S11nxQm4AiMb9FSep7I2a9IhUh34q7QeSfyu3JSUTOC/ UrEw== X-Gm-Message-State: AOJu0Yx5sURSko/f7UICZrjSBcMTVna8MvrhPuWAUlENGySGjK2npYJQ h7RzCSaqxxFDKgs5bJE17FV9nbFoSuHZijjEuWA= X-Google-Smtp-Source: AGHT+IGTXxgqTc0eF1pAohFNVz3FhQ7nJ3heX+JRXriKIDn8FnI3rmj+Zt1qZCLsGVqCqkHDnKNP9NYE0iYQp3ADV7I= X-Received: by 2002:aa7:c691:0:b0:557:c93a:d726 with SMTP id n17-20020aa7c691000000b00557c93ad726mr341547edq.53.1704884882442; Wed, 10 Jan 2024 03:08:02 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 10 Jan 2024 03:08:02 -0800 From: Stefan Kangas In-Reply-To: <834jr0byz0.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Mar 2023 12:19:31 +0200") References: <9c0bc5b9-4dad-993a-f0e8-5aebca46a52e@gmx.de> <834jr0byz0.fsf@gnu.org> MIME-Version: 1.0 Date: Wed, 10 Jan 2024 03:08:02 -0800 Message-ID: Subject: Re: bug#61925: 30.0.50; normal-mode does not set up local variables in temporary buffers (scratch, with-temp-buffer) To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61925-done Cc: 61925-done@debbugs.gnu.org, Wolfgang Scherer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: > 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 =E2=80=98set-aut= o-mode=E2=80=99 > (see below). As of Emacs 26.1, it no longer runs > =E2=80=98hack-local-variables=E2=80=99, this now being done in =E2= =80=98run-mode-hooks=E2=80=99 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 =E2=80=98run-hooks=E2=80=99 (*note Hooks::), but it also = runs > =E2=80=98change-major-mode-after-body-hook=E2=80=99, =E2=80=98hack-l= ocal-variables=E2=80=99 (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. It seems like we're not going to be making any changes here, as this is the expected behavior. I'm therefore closing this bug report. From unknown Wed Jun 18 23:04:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 07 Feb 2024 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator