unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Joseph Turner <joseph@breatheoutbreathe.in>
Cc: 60643@debbugs.gnu.org
Subject: bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables
Date: Sun, 08 Jan 2023 08:00:11 +0200	[thread overview]
Message-ID: <83ilhhr2fo.fsf@gnu.org> (raw)
In-Reply-To: <87eds5r5d4.fsf@breatheoutbreathe.in> (bug-gnu-emacs@gnu.org)

> Date: Sat, 07 Jan 2023 20:48:54 -0800
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> It appears that set-buffer-major-mode resets buffer local variables.
> 
> To reproduce with `emacs -Q`:
> 
> (defvar-local test-var nil)
> (setq test-var t)
> (message "%s" test-var) ;; t
> ;; (set-auto-mode)
> (set-buffer-major-mode (current-buffer))
> (message "%s" test-var) ;; nil
> 
> Is this behavior expected?

Yes, I think so.  Changing the major mode kills all buffer-local
variables.  If you don't want some variable to be killed, give it the
permanent-local property.





  parent reply	other threads:[~2023-01-08  6:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-08  4:48 bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08  5:45 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08  6:00 ` Eli Zaretskii [this message]
2023-01-08  9:09   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08  9:09   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=83ilhhr2fo.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=60643@debbugs.gnu.org \
    --cc=joseph@breatheoutbreathe.in \
    /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).