From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Burks Newsgroups: gmane.emacs.bugs Subject: bug#70186: Variable watcher notification bugs for "local if set" variables. Fix and ert in email to follow. (5 of 9) Date: Thu, 4 Apr 2024 04:46:07 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000004948ab0615416309" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18395"; mail-complaints-to="usenet@ciao.gmane.io" To: 70186@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 04 11:18:29 2024 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 1rsJEr-0004bR-EE for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Apr 2024 11:18:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rsJES-0007xc-Er; Thu, 04 Apr 2024 05:18: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 1rsJEQ-0007vn-VR for bug-gnu-emacs@gnu.org; Thu, 04 Apr 2024 05:18: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 1rsJEQ-0000D5-JZ for bug-gnu-emacs@gnu.org; Thu, 04 Apr 2024 05:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rsJEV-0004oX-9H for bug-gnu-emacs@gnu.org; Thu, 04 Apr 2024 05:18:07 -0400 X-Loop: help-debbugs@gnu.org 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-Debbugs-Original-To: GNU BUGS Original-Received: via spool by submit@debbugs.gnu.org id=B.171222227718320 (code B ref -1); Thu, 04 Apr 2024 09:18:06 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Apr 2024 09:17:57 +0000 Original-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 Original-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 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 1rsIkp-0002my-97 for bug-gnu-emacs@gnu.org; Thu, 04 Apr 2024 04:47:27 -0400 Original-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 Original-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) 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-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 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:282626 Archived-At: --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--