From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#65209: 30.0.50; Unexpected behaviour of setq-local Date: Fri, 11 Aug 2023 06:56:01 +0200 Message-ID: <2c06d6df-dd6d-78c4-f4dd-44cac8d95d84@gmail.com> References: <953357c8-83b4-5d7f-7638-e79382ad164c@gmail.com> <87zg2yfn53.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="787"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Cc: 65209@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 11 06:57:11 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 1qUKD1-000AeG-8k for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Aug 2023 06:57:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUKCu-0004Gj-Oj; Fri, 11 Aug 2023 00:57: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 1qUKCs-0004GQ-Kj for bug-gnu-emacs@gnu.org; Fri, 11 Aug 2023 00:57: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 1qUKCs-00080o-CO for bug-gnu-emacs@gnu.org; Fri, 11 Aug 2023 00:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qUKCs-0005GV-8R for bug-gnu-emacs@gnu.org; Fri, 11 Aug 2023 00:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Aug 2023 04:57:02 +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.169172977420169 (code B ref 65209); Fri, 11 Aug 2023 04:57:02 +0000 Original-Received: (at 65209) by debbugs.gnu.org; 11 Aug 2023 04:56:14 +0000 Original-Received: from localhost ([127.0.0.1]:44651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUKC6-0005FF-0y for submit@debbugs.gnu.org; Fri, 11 Aug 2023 00:56:14 -0400 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:60478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUKC1-0005Ey-DS for 65209@debbugs.gnu.org; Fri, 11 Aug 2023 00:56:12 -0400 Original-Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-522bd411679so1973187a12.0 for <65209@debbugs.gnu.org>; Thu, 10 Aug 2023 21:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691729763; x=1692334563; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=mB1ROM5za5cJ/9rhvv/RcVnfrGrgGrNSFoEu6umQQyc=; b=O98ZHBW0GNDitDLYkbOtQEKGkWTrObS4HWug6KdfVJiDZcPqMiswB+PcdFyGhxf7Mr z7+7y55upY69EDpVOvYUHIwGcnlarEau+flJMf1NK42d/l7qzvm6j9YdOTdtv/fSNO1d VvDW3eek5l90sjTMIfDENYbEWfDoMlX7B5l2l28iYno6d3vkeD8ZEjWFo9LnIFaloOGt 4j/1pMSKEhLT8n1GoKD0TA14/mpiYpmic+stXfvy7wGFxylj8F6lCpOQY5pK+BMtqMnU YWvsE6dne0Y0JUDlHqGui/WlHQV15VeLpNXjR0mc4nodabYqsmAo0zr7wYg2VcvwqWSi +Hug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691729763; x=1692334563; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mB1ROM5za5cJ/9rhvv/RcVnfrGrgGrNSFoEu6umQQyc=; b=T6GVndGv75DCakHbLbVTEqV66r7w+Zz/0l0IA1biNLkqwnTEj+gOaWrtQRoNnxBUt+ LyTxPRi+ERT4qwHfYrdNWWpBhV1A4BRouOwvoTs0pmj4hQqvFaiZTIquNT3JiYHsHs22 e4TKe6LotGhSD1RwM/QTuPWwkWm/0bguei68adHtVTfQgoy2imtmcwk8RO7GEcIV8+4m PDUDSiKxvst1tYTZi1MxkYILuqv3zSOkie5SCvJ2vm3p2Wl4ml3ljwANQFuaUCk13vFL LpQ8subZ3g/+T+ZpBRWDiRJmO9mWp1ZoQ0bvqUFRu2J0RZAm000+OfiD2sIhZ3ulLAzu ssPQ== X-Gm-Message-State: AOJu0Yzir3I4BJUyzJp/g/ApmnogitndkJkeBAzebIM08iSbAEVF9m0u 3a611Fa6S0fedULLTmMzykGCczIEygg= X-Google-Smtp-Source: AGHT+IEXzCFmbYzgoAceQ9h3n+d5qRWSrXOteJt973bIIdTWkWCttIlat2lENYAxmN+jD4LNxxFIzA== X-Received: by 2002:a05:6402:1643:b0:523:6b00:2440 with SMTP id s3-20020a056402164300b005236b002440mr704441edx.30.1691729763257; Thu, 10 Aug 2023 21:56:03 -0700 (PDT) Original-Received: from [192.168.178.21] (p54b0c042.dip0.t-ipconnect.de. [84.176.192.66]) by smtp.gmail.com with ESMTPSA id m4-20020aa7c2c4000000b0051e0be09297sm1579471edp.53.2023.08.10.21.56.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Aug 2023 21:56:02 -0700 (PDT) Content-Language: en-US In-Reply-To: <87zg2yfn53.fsf@web.de> 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:267183 Archived-At: On 11.08.23 02:17, Michael Heerdegen wrote: > Gerd Möllmann writes: > >> 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. > > But isn't it expected that `let' restores the value that was present > before entering `let'? That's right, but here's what the docs say about setq-local: -- Macro: setq-local &rest pairs PAIRS is a list of variable and value pairs. This macro creates a buffer-local binding in the current buffer for each of the variables, and gives them a buffer-local value. It is equivalent to calling ‘make-local-variable’ followed by ‘setq’ for each of the variables. In my first example, setq-local doesn't create a buffer-local binding. In the second example, it doesn't set a buffer-local value. So setq-local doesn't what the first sentence of the doc says it does. The second sentence of the doc says something quite different than the first sentence because setq in the presence of a let-binding of course sets the value of the let-binding. What's the right thing to do here I find hard to tell. I think I'd personally prefer if setq-local did what the first sentence says. Just to make things in general easier to understand, I guess. I mean, the let-binding which changes the behaviour of lisp-interaction-mode in my case could be anywhere. It's kind of like a spooky action at a distance. Good luck debugging something like that. But that's just my 2 cents.