From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65209: 30.0.50; Unexpected behaviour of setq-local Date: Sun, 13 Aug 2023 12:43:32 -0400 Message-ID: References: <953357c8-83b4-5d7f-7638-e79382ad164c@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16791"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65209@debbugs.gnu.org To: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 13 18:44:13 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 1qVECK-0004Dz-QX for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Aug 2023 18:44:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVECC-0004sR-SP; Sun, 13 Aug 2023 12:44:04 -0400 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 1qVECA-0004sE-CG for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2023 12:44:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVECA-0003uY-34 for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2023 12:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qVEC9-0006WQ-V7 for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2023 12:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Aug 2023 16:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65209 X-GNU-PR-Package: emacs Original-Received: via spool by 65209-submit@debbugs.gnu.org id=B65209.169194502225036 (code B ref 65209); Sun, 13 Aug 2023 16:44:01 +0000 Original-Received: (at 65209) by debbugs.gnu.org; 13 Aug 2023 16:43:42 +0000 Original-Received: from localhost ([127.0.0.1]:60170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVEBp-0006Vk-V0 for submit@debbugs.gnu.org; Sun, 13 Aug 2023 12:43:42 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10070) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVEBo-0006VW-6t for 65209@debbugs.gnu.org; Sun, 13 Aug 2023 12:43:40 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8CAA21000E4; Sun, 13 Aug 2023 12:43:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1691945013; bh=mYOekfOH5p4qKa0rF0QnPJcCbpiiLD++LBtzumuwrso=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=F2ykj06SWwuhTLIUs1taur1kXApjGP3XK/0dTtTH+6KNvv3rvsQvxSDGm4d12FxDy wT494XKIOPiKYjQqa2LXosEV+rYSK4YCb4Cg9guA0DmsqUjC4NvRr/xlBhyU0RWGTW tUoni4vrkkFUXGu++637BelXQELbE309mn4yzIOXwyCJQZ4YnVnz4QM5IzS+nckX7p S8sisU5F8970wF9MN5iKNJX5uNXRKJBwoYAkSkkkY06/8yi7VoThV9nd9uziYeNem5 8iDK/DUBFlr+xRO8ARW5Rw83Sr87qlrvT97yIeptLY8aNEAbKKqOpnr/rBHymjxlPe 1/PZvm65O/W5w== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 88CBA1000A3; Sun, 13 Aug 2023 12:43:33 -0400 (EDT) Original-Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5F6DA120377; Sun, 13 Aug 2023 12:43:33 -0400 (EDT) In-Reply-To: <953357c8-83b4-5d7f-7638-e79382ad164c@gmail.com> ("Gerd =?UTF-8?Q?M=C3=B6llmann?="'s message of "Thu, 10 Aug 2023 15:50:26 +0200") 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:267375 Archived-At: > Evaluate the following > > (progn > (defvar my-var :default-value) > (make-variable-buffer-local 'my-var) > (let ((my-var :let-value)) > (setq-local my-var :buffer-local-new)) > my-var) > => :default-value > > (progn > (defvar my-var1 :default-value) > (make-variable-buffer-local 'my-var1) > (setq my-var1 :buffer-local) > (let ((my-var1 :let-value)) > (setq-local my-var1 :buffer-local-new)) > my-var1) > => :buffer-local > > In both cases, setq-local has no effect. Hmm... this is a bug in `make-local-variable` where we do: if (blv ? blv->local_if_set : (forwarded && BUFFER_OBJFWDP (valcontents.fwd))) { tem = Fboundp (variable); /* Make sure the symbol has a local value in this particular buffer, by setting it to the same value it already has. */ Fset (variable, (EQ (tem, Qt) ? Fsymbol_value (variable) : Qunbound)); return variable; } I.e. we assume that if a var is `make-variable-buffer-local` then `set` will make sure it has a buffer-local value, but this is not true if the var is currently let-bound. 40 years after buffer-local and let-bindings were brought together and we're still finding bugs :-( Stefan