From unknown Sat Jun 21 03:16:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70186: Variable watcher notification bugs for "local if set" variables. Fix and ert in email to follow. (5 of 9) Resent-From: Robert Burks Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Apr 2024 09:18:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70186 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 70186@debbugs.gnu.org X-Debbugs-Original-To: GNU BUGS Received: via spool by submit@debbugs.gnu.org id=B.171222227718320 (code B ref -1); Thu, 04 Apr 2024 09:18:06 +0000 Received: (at submit) by debbugs.gnu.org; 4 Apr 2024 09:17:57 +0000 Received: from localhost ([127.0.0.1]:60539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rsJEK-0004lL-Lm for submit@debbugs.gnu.org; Thu, 04 Apr 2024 05:17:57 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rsIkz-0001vW-IV for submit@debbugs.gnu.org; Thu, 04 Apr 2024 04:47:38 -0400 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 1rsIkp-0002my-97 for bug-gnu-emacs@gnu.org; Thu, 04 Apr 2024 04:47:27 -0400 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsIkn-0002EU-IR for bug-gnu-emacs@gnu.org; Thu, 04 Apr 2024 04:47:27 -0400 Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-699320fcbc1so2298066d6.3 for ; Thu, 04 Apr 2024 01:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712220443; x=1712825243; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=QnVJY5BDX//waBdH8iNAyveIy9hHkCMc1/nr6MHv5iY=; b=hMa6RbNkeuK5tczE/Mu/namVQFA0+nb5HdrcSD259cb/iaMT8jGQ6C1IQshVCeFC6X iha+HClDgwBlzYybt+GGUNJiFk4dvuqgzntL7l0CnFQAa4a7NwjVvkRI0X1ygSYnkJw2 sHTfayklQij0PBVfuPvr7IpEAy3DivIZso4Ogqr6jOmft5KomUO6Aq1k8z+M9zYJxIln Dvc2tLIBDEoLi3RlFkBWZyvYqJBks3PhFuyfbeKgGWuhDL+PosTYYgcClKauiYKITol4 FVr1Un4K87CzR7rOeaJ7g+x2VvcehvypkFlVLEFNjUymk/3lhrsj8WlL2a/IVKbaarX2 RWTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712220443; x=1712825243; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=QnVJY5BDX//waBdH8iNAyveIy9hHkCMc1/nr6MHv5iY=; b=WRDi3wwjmH6aBpeBG/+HP5fw2l8GzvfXYxAVRFzihHcEXEL8Aa1fi5CnQy4ypcyqGY lhuNRSd1BjIIJI5J40KkFvn9I9TV8jZin+p2EgO6RXFPNBL1VQfebuOuZ2aUlZ8gnQss cUwiozaWq+VNfaxhZShv64yI3qAgprFf9xwaTJ5t9nROtrcuh4hqxvxKdiVMllO8OkpX +l1q4m7GHk9sFC9M9QCt06Voh85UtdzSXPaZt29E49TdKEEdqU0UvWR5TNmHB51jKapf 06RRcrDn4EP3h+iBmnJ5O9fIpvnWAZLkaQHkh9gbk87cbUlZK9ADftc+syyxo0EGg/iE hpoQ== X-Gm-Message-State: AOJu0Yxw5AFgUys9c9jbh492T/FLem/r3zhFvx6W1Q971//TSfMMTmoK DcGg+3jN73lyaPtRCgUUJdp5Yzr/IsQcQoRyxIPRlh4IrDHQKj7DSWpuHeGWLrk+IfBpCtsgcsC /rJn6IoGIF3Ryqel4M8itjsn+8Td3Jsg= X-Google-Smtp-Source: AGHT+IESho0UckkJumSC8lILsUkoRDyrA+sZxSEfKPB0geXHZD91JzWEmEttShXkEbneC66A6UAXFIwChu7XxUINrHA= X-Received: by 2002:a05:6214:21ca:b0:696:a982:92a6 with SMTP id d10-20020a05621421ca00b00696a98292a6mr2375844qvh.9.1712220443066; Thu, 04 Apr 2024 01:47:23 -0700 (PDT) MIME-Version: 1.0 From: Robert Burks Date: Thu, 4 Apr 2024 04:46:07 -0400 Message-ID: Content-Type: multipart/alternative; boundary="0000000000004948ab0615416309" Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a; envelope-from=rburksdev@gmail.com; helo=mail-qv1-xf2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Mailman-Approved-At: Thu, 04 Apr 2024 05:17:46 -0400 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: -0.0 (/) --0000000000004948ab0615416309 Content-Type: text/plain; charset="UTF-8" (5 of 9) Bug#00004 (no corresponding unlet notification and improper use of 'where' for local_if_set buffer local variables that shadow default.) ** Bug recreations are at the end I have included a patch for this bug that applies on top of my four previous submissions in the following email. This bug occurs because an unaccounted for path in do_one_unbind calls set_default_internal. Current regression testing only tests reaching the section of code my patch resides in from a direct call using set-default. I have also included testing that covers all the examples provided in the next email. It was the end of this bug's testing in which I unraveled even more existing bugs in which my work did not already solve. The bug following this required being solved in conjunction with this bug. Bug Recreation------------------------------------------------------------------ ------------------------------------------- - LIS let and set in the same buffer. (shadows default) ------------------------------------------- (defvar-local test 100) test (defvar results nil) results (add-variable-watcher 'test (lambda (&rest args) (push args results))) nil (let ((test 99)) (set 'test 66)) 66 results ((test 100 set nil) (test 66 set #) (test 99 let #)) ;; there should be an unlet and the others should not have a 'where'!!!!!!!!! ;; Every let should have a corresponding unlet so a watcher function can relieve ;; it's activity (if so desired) of watching its variable in a particular buffer ;; and then resume it after the unlet occurs in that particular buffer. ;; Also, in this example the 'let' is acting on the default value as this is a ;; 'let_shadows_default' case. The 'let','set', and 'unlet' all act on the default for ;; all variables that do not have their own value. It should not have a 'where'. ------------------------------------------- - LIS let and set in some buffer. (shadows default) ------------------------------------------- (defvar-local test 5) test (defvar results nil) results (add-variable-watcher 'test (lambda (&rest args) (push args results))) nil (with-temp-buffer (let ((test 99)) (set 'test 66))) 66 results ((test 5 set nil) (test 66 set #) (test 99 let #)) --0000000000004948ab0615416309 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
(5 of 9)

Bug#00004 (no corresponding unlet notifica= tion and improper use of 'where'
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 for local_if_set buffer local variables that shadow default.)
** Bug recreations are at the end =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <= br>
I have included a patch for this bug that applies on top of my four = previous
submissions in the following email.=C2=A0 This bug occurs becau= se an unaccounted for
path in do_one_unbind calls set_default_internal.= =C2=A0 Current regression testing
only tests reaching the section of cod= e my patch resides in from a direct call
using set-default.=C2=A0 I have= also included testing that covers all the examples
provided in the next= email.

It was the end of this bug's testing in which I unravele= d even more existing bugs
in which my work did not already solve.=C2=A0 = The bug following this required being
solved in conjunction with this bu= g.


Bug Recreation-----------------------------------------------= -------------------

-------------------------------------------
-= LIS let and set in the same buffer. (shadows default)
-----------------= --------------------------
(defvar-local test 100)
test

(defva= r results nil)
results

(add-variable-watcher 'test (lambda (&= amp;rest args)
=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 (push args results)))
n= il

(let ((test 99))
=C2=A0 (set 'test 66))
66

resul= ts
((test 100 set nil) (test 66 set #<buffer *scratch*>) (test 99 = let #<buffer *scratch*>))
;; there should be an unlet and the othe= rs should not have a 'where'!!!!!!!!!
;; Every let should have a= corresponding unlet so a watcher function can relieve
;; it's activ= ity (if so desired) of watching its variable in a particular buffer
;; a= nd then resume it after the unlet occurs in that particular buffer.
;; A= lso, in this example the 'let' is acting on the default value as th= is is a
;; 'let_shadows_default' case.=C2=A0 The 'let',&= #39;set', and 'unlet' all act on the default for
;; all vari= ables that do not have their own value.=C2=A0 It should not have a 'whe= re'.

-------------------------------------------
- LIS let an= d set in some buffer. (shadows default)
--------------------------------= -----------
(defvar-local test 5)
test

(defvar results nil)results

(add-variable-watcher 'test (lambda (&rest args)=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 (push args results)))
nil

(with-t= emp-buffer
=C2=A0 (let ((test 99))
=C2=A0 =C2=A0 (set 'test 66)))=
66

results
((test 5 set nil) (test 66 set #<killed buffer&= gt;) (test 99 let #<killed buffer>))


--0000000000004948ab0615416309-- From unknown Sat Jun 21 03:16:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70186: Variable watcher notification bugs for "local if set" variables. Fix and ert in email to follow. (5 of 9) Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Apr 2024 07:38:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70186 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Robert Burks , Stefan Monnier Cc: 70186@debbugs.gnu.org Received: via spool by 70186-submit@debbugs.gnu.org id=B70186.171238906922967 (code B ref 70186); Sat, 06 Apr 2024 07:38:04 +0000 Received: (at 70186) by debbugs.gnu.org; 6 Apr 2024 07:37:49 +0000 Received: from localhost ([127.0.0.1]:38093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rt0cV-0005y0-KH for submit@debbugs.gnu.org; Sat, 06 Apr 2024 03:37:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rt0cT-0005xa-2k for 70186@debbugs.gnu.org; Sat, 06 Apr 2024 03:37:45 -0400 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 1rt0cH-0001zW-NQ; Sat, 06 Apr 2024 03:37:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=TxUH76+y8Yk/BT30aSWZnmyDG2Atkjv4xoytSsMYjho=; b=pahmUOQv2RxR +rCglGiYBWra8Z5nLPABCWqygAkaB1CTFvp/0UoXQlCHNXQTYtnDmI4fZfd0xzNOcYAJvFBrunO9K UiWw1zpw8LWDjescUv2j0xvKORn9d+P76jR9Dr+eARGf5yEr+P0+UvhG8f9ZcKHoDOltkt0SxJegv egmfpBaOQjKKqmAZ8dI2YksCsyKYCl/w3v/3qdx9FScaczuKex/k9pnWWvHqJ88PZikIuRRmGvGJ8 lq/eiO3iBZryCQDYjjX16HY4sX+UK7Ip5KgP5pgWzJHZsYGOvCYdjmqVv8giQkuoVLxjvlhu7KplS KYsOskLRC2DyJVbdh4wiww==; Date: Sat, 06 Apr 2024 10:37:31 +0300 Message-Id: <86msq73ps4.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Robert Burks on Thu, 4 Apr 2024 04:46:07 -0400) References: X-Spam-Score: -2.3 (--) 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 (---) > From: Robert Burks > Date: Thu, 4 Apr 2024 04:46:07 -0400 > > (5 of 9) > > Bug#00004 (no corresponding unlet notification and improper use of 'where' > for local_if_set buffer local variables that shadow default.) > > ** Bug recreations are at the end > > I have included a patch for this bug that applies on top of my four previous > submissions in the following email. This bug occurs because an unaccounted for > path in do_one_unbind calls set_default_internal. Current regression testing > only tests reaching the section of code my patch resides in from a direct call > using set-default. I have also included testing that covers all the examples > provided in the next email. > > It was the end of this bug's testing in which I unraveled even more existing bugs > in which my work did not already solve. The bug following this required being > solved in conjunction with this bug. > > Bug Recreation------------------------------------------------------------------ > > ------------------------------------------- > - LIS let and set in the same buffer. (shadows default) > ------------------------------------------- > (defvar-local test 100) > test > > (defvar results nil) > results > > (add-variable-watcher 'test (lambda (&rest args) > (push args results))) > nil > > (let ((test 99)) > (set 'test 66)) > 66 > > results > ((test 100 set nil) (test 66 set #) (test 99 let #)) > ;; there should be an unlet and the others should not have a 'where'!!!!!!!!! > ;; Every let should have a corresponding unlet so a watcher function can relieve > ;; it's activity (if so desired) of watching its variable in a particular buffer > ;; and then resume it after the unlet occurs in that particular buffer. > ;; Also, in this example the 'let' is acting on the default value as this is a > ;; 'let_shadows_default' case. The 'let','set', and 'unlet' all act on the default for > ;; all variables that do not have their own value. It should not have a 'where'. > > ------------------------------------------- > - LIS let and set in some buffer. (shadows default) > ------------------------------------------- > (defvar-local test 5) > test > > (defvar results nil) > results > > (add-variable-watcher 'test (lambda (&rest args) > (push args results))) > nil > > (with-temp-buffer > (let ((test 99)) > (set 'test 66))) > 66 > > results > ((test 5 set nil) (test 66 set #) (test 99 let #)) Stefan, any comments?