Stéphane Marks <shipmints@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Received: (at 81849) by debbugs.gnu.org; 12 Sep 2026 14:52:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 12 10:52:00 2026 Received: from localhost ([127.0.0.1]:53178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1x5P5E-0000sa-2N for submit <at> debbugs.gnu.org; Sat, 12 Sep 2026 10:52:00 -0400 Received: from mail-vs2-x0f.google.com ([2a00:1450:4864:3a::f]:44541) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>) id 1x5P59-0000s9-VW for 81849 <at> debbugs.gnu.org; Sat, 12 Sep 2026 10:51:57 -0400 Received: by mail-vs2-x0f.google.com with SMTP id ada2fe7eead31-78564313adaso113735137.3 for <81849 <at> debbugs.gnu.org>; Sat, 12 Sep 2026 07:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1789224710; cv=none; d=google.com; s=arc-20260327; b=Ua2yMi3QpfUhl32eGuo3WuP3Cy+kptyr9eXbyWBbj8voq7366u7OMcz774ydRK8v6U Gyvvedi5Ra9GfGjgndLi0U2OEDFF+JNuLJ6DpXPz5Xh8PJnjceJ6AeJXev6NbIMP1z6r hn+Mv1LSR+W2JEsJc6FFvY7IdCge0SXLHY3H9g4Xzfb2x+QVTXoupRozvgOrzRlBJ+ca XM6YARTU4uHOEtmUCNLOKUqW1IF1+NZzb8nu4YnBZOr6u8fbSZS0h4SAGPYZq3tlIKwA cBRU40tA3ruVE8UDLmB8kyJV+9wGi4uEoRuQ74DJm8nJHt7Lk4TyAIG0DU18mg0N94nc PdYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=nggI4sZC1s70PS9IQwnvtB+fs5U536NTT+kdvbJyDSk=; fh=7R5OF2maqPRuoRcbTe7eDtMTPVtYRl8ssR+trG9g/LE=; b=XK3HZeaSvbpA++NWy+rtp5ZbkB3Ae/e4x3V+vpv5x8KECaSEKKhhcScJ4RzRmaT2wE 8YhNez3tYKTsGsRl8gx4ahmIQWezGVRi1SseNc90vT51v3NKkSEvS15vb5kNwrLSrwRz VSHCicHg3xi233KIXSaRPfV3zbSHQqBnOb0HM59xikuaKrg9u60ASbE4Oa3b5aEbDXEt ZRaLR+en8q9Q7MrzeKiYxgzIEFv9OrEydymLbjtcrtzACgC/8TCBHFVp0sXzYCYcci7p hvdgyHETsw779mNxwuEZZ5CkUuKC8xAOLsdVjsnIHxA7DBiHys1iIeYcpYwn6F4u9oSE Z2eA==; darn=debbugs.gnu.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789224710; x=1789829510; darn=debbugs.gnu.org; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:from:to:cc:subject:date:message-id:reply-to :content-type; bh=nggI4sZC1s70PS9IQwnvtB+fs5U536NTT+kdvbJyDSk=; b=qaz0vDef/9Rvc3+DK8kX3b3E5JBF6UGEHA+cwg5K2YHDMZMYNmcxVWJ9sqFabO1DmF aFAGVlK7/CPlwNTTySeuJegdXIU09DKeZ0U5Xad5Mq0JZ4F4tnPUBhxZPHay5lThMNW2 OC7HZrvF7K+cSyotj/HlkF5FsvCaUT/RBJW/9Dxpt+Ukb4zKfPM7va7t6NnsyCqqaIzU bXGnapqgY0IGpMmTKbiOzvnA1qj/gULyZ4i6EBxEQf0Xe7Pi4dXobclc7XGpnQ6qH22p xPn7YQ1GEjZDS5/lm3UgHjXpq9Nvx6VHUxi/I+EIsWlng+qoGw+mI+RhvmsvH/j6ckLF zwpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789224710; x=1789829510; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=nggI4sZC1s70PS9IQwnvtB+fs5U536NTT+kdvbJyDSk=; b=M9b4nIjlrWiBymsrEIGR/WhX1dcPVxdAdz7l/cQaen7U1LerriMHHFeRmk6PaVmvfI R7hTM42/PW1Unn50cOyLuyZepScPjy6HQOtgt17oL/pO6Ixqow8aDw3t3DGxFj4Snkzr k6LTu4eYTj3BsJcSoa93v1EpJKPpXlxYQKcfS/lZlW6x1RPTe1nyhBkffiH2ysMTQKil pemCd03nniFAkqnxkE8DktSGTdOPLv06MrEI7VQEIkbBBUVypiUKVpySYb+EqMSocFCQ RIYVJkPnjdKgdyrPUGCyyc8Fe1mUKrqFHFkbqgK2tUL37VsP0vto3QyYETDavIrDqOFV fC7w== X-Gm-Message-State: AFuF++kwGsWzMQXwvHfEsN2gWX2dghWdYgnPIWqlXH9wTjJZVkbheRSy u5tERQbr6QdX5pss6o4nN8tU8BcNvmp3lwDAlLpd9n2XJnzos3z+p4feHWM4WEGl7O3WBKO7rmP 3lklMkQha7N2Usi9evUIGxt0iES4PzrPjvwu0qtc= X-Gm-Gg: AYBFou2nzrpTBDzLbYbjS8gHRz2CxW2GaPy5z3WG1hCh7dsiMS3RYPxkcD3WIBmi6Co gmMNz++nvqWDzkDBSFbTs4c+smL0hWOpmO+VmkoXpBmD0JAcDg3KwvHDk4EkVpx5d/JbptB/M9s +ofgRXA02qdbkX1xhLwjzFLh6pq1CW7SpIiQjCtdOwfyb4MDP5l2gknfF/X1Ls+QqIkASWt8qpW VclEcvpoMtVcauOSn8WoTAWXJCwEHH+VKl+CXzG/ZPxcxR4rpeNomvlfItzhUr2TWOEIa+NMwbI CEKC9DVrIlx0RdgdAXCHX+AeVYr8S9AICzyEo+KErmWMnj165EXW48jfsm1S4cguUqiX9X5KOxS iRrEhJfoyU0udVLdG+aouOIyqLCduqPiI6oBrxG7rhkCtbCKdmkRZ+RHb9U/D5ki0ElDaEirskE 51hIygC/rzmwRSLECvBlNtjeF/m7DaUImjrpCGG+tV2EY30d5wGMaqwtRhrHfVgFY4bLMFau1MI NrcZEC6S2I98fqs X-Received: by 2002:a05:6102:2acd:b0:791:8f69:b802 with SMTP id ada2fe7eead31-795a8606d9bmr2133996137.7.1789224710013; Sat, 12 Sep 2026 07:51:50 -0700 (PDT) MIME-Version: 1.0 References: <CAFChFyjuZfax3tJ--k17X8oo+BJO41N5PJ5f5bxjAWz3d0FuwQ@HIDDEN> <CAN+1Hbo1SfEn1V5gwXTooHo=MtNZfSoD4OdKW-PGwqOyy=dNjg@HIDDEN> <CAFChFyinYsSMspGSkEy05X3L-H_W35TzexjFK95v8H-LC_Jbtg@HIDDEN> In-Reply-To: <CAFChFyinYsSMspGSkEy05X3L-H_W35TzexjFK95v8H-LC_Jbtg@HIDDEN> From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN> Date: Sat, 12 Sep 2026 10:51:39 -0400 X-Gm-Features: AcwNN1VL_SiUkhxvq7xAv0lBl8-EghfiJlHeu1_ceGjpj0LfxSv6n6QJbEKwo2w Message-ID: <CAN+1HbpwMHT0M1tf-UoZ5MccUKc9aOYGzY_q8pjMNAJNtMWaBQ@HIDDEN> Subject: Re: bug#81849: 32.0.50; (kill-all-local-variables 'reset) keeps local bindings To: Gary Oberbrunner <garyo@HIDDEN> Content-Type: multipart/alternative; boundary="000000000000438974065b4a5705" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 81849 Cc: 81849 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) --000000000000438974065b4a5705 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable merge 81254 81849 thanks On Sat, Sep 12, 2026 at 10:49=E2=80=AFAM Gary Oberbrunner <garyo@oberbrunne= r.com> wrote: > Thanks; that patch definitely fixes my issue. Confirmed. > > -- Gary > > On Sat, Sep 12, 2026 at 7:17=E2=80=AFAM St=C3=A9phane Marks <shipmints@gm= ail.com> > wrote: > >> On Fri, Sep 11, 2026 at 10:47=E2=80=AFPM Gary Oberbrunner <garyo@oberbru= nner.com> >> wrote: >> >>> In recent master, `(kill-all-local-variables 'reset)` doesn't remove an= y >>> buffer-local bindings. Plain and `t` arguments still do. >>> >>> This showed up for me because I use doom-modeline and any command durin= g >>> which the mode line is evaluated and a `:eval` form calls >>> `string-pixel-width` deactivates the region. With doom-modeline, the f= irst >>> `C-SPC C-n` in a fresh buffer doesn't get a region set. >>> >>> This seems to be because `work-buffer--release` relies on `'reset` to >>> flush the reusable work buffer, and one variable in there >>> is `deactivate-mark`, which becomes buffer-local when set and is set by= the >>> `add-text-properties` and `erase-buffer` calls in >>> `work-buffer--prepare-pixelwise` and `work-buffer--release` (only the >>> `insert` is inside a `let`). >>> >>> Recipe (emacs -Q in batch) >>> ----------------- >>> emacs -Q --batch --eval '(progn (transient-mark-mode 1) (defun bug () >>> (interactive) (set-mark (point)) (string-pixel-width "x")) (global-set-= key >>> (kbd "C-c b") (function bug)) (with-current-buffer (generate-new-buffer >>> "t") (insert "abc") (execute-kbd-macro (kbd "C-c b")) (message >>> "mark-active: %S" mark-active)))' >>> >>> Expected: mark-active: t >>> Observed: mark-active: nil >>> >>> Removing the `string-pixel-width' call gives t. Replacing it with >>> `(with-work-buffer (insert "x"))', or with `(with-current-buffer >>> (get-buffer-create " *k*") (insert "a") (kill-all-local-variables >>> 'reset))', gives nil again; with `(kill-all-local-variables)' or >>> `(kill-all-local-variables t)' in that form it gives t. >>> >>> Recipe, interactive (GUI or -nw) >>> -------------------------------- >>> >>> 1. emacs -Q >>> 2. M-: (global-set-key (kbd "C-c b") (lambda () (interactive) (set-mark >>> (point)) (forward-char 3) (string-pixel-width "x"))) RET >>> 3. C-x C-f /tmp/anything.txt RET (an existing file with some text; do >>> not type in the buffer) >>> 4. C-c b >>> Expected: a three-character region is active and highlighted. >>> Observed: no region, `mark-active' is nil. >>> >>> Note: the problem is masked in any buffer where `deactivate-mark' has >>> a buffer-local binding, i.e. any buffer that has been edited since its >>> last major-mode change. >>> >>> Suggested fixes >>> --------------- >>> >>> - Make `(kill-all-local-variables 'reset)` and `'permanent-local' >>> actually remove the local bindings, as documented. >>> >>> - Separately, `with-work-buffer' could bind `deactivate-mark' for >>> the whole body plus release, instead of only around `insert', so >>> that measuring a string never has this side effect regardless of how >>> the work buffer is flushed: >>> >>> (with-current-buffer ,work-buffer >>> (let (deactivate-mark) >>> (unwind-protect >>> (progn ,@body) >>> (work-buffer--release ,work-buffer)))) >>> >>> Environment >>> ----------- >>> >>> In GNU Emacs 32.0.50 (build 1, aarch64-apple-darwin25.5.0, NS >>> appkit-2685.60 Version 26.5.2 (Build 25F84)) of 2026-08-15 >>> Repository revision: 73add0e2bfb63ceb39e5166c9d3eb2fee7ad0ef3 >>> Repository branch: master >>> System: macOS 26.5.2 (Darwin 25.5.0), aarch64 >>> Features: ACL DBUS GLIB GNUTLS LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY >>> KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS >>> TREE_SITTER WEBP XIM XWIDGETS ZLIB >>> >> >> I think this is the same as >> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D81254 which has a patch >> pending for installation. I'm attaching that patch here. Please try it >> and see if it solves your issue. >> > > > -- > Gary > --000000000000438974065b4a5705 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospac= e">merge=C2=A081254 81849</div><div class=3D"gmail_default" style=3D"font-f= amily:monospace">thanks</div></div><br><div class=3D"gmail_quote gmail_quot= e_container"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Sep 12, 2026 at = 10:49=E2=80=AFAM Gary Oberbrunner <<a href=3D"mailto:garyo@HIDDEN= om">garyo@HIDDEN</a>> wrote:<br></div><blockquote class=3D"gmai= l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20= 4,204);padding-left:1ex"><div dir=3D"ltr">Thanks; that patch definitely fix= es my issue. Confirmed.<div><br></div><div>-- Gary</div></div><br><div clas= s=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Sep 12, 202= 6 at 7:17=E2=80=AFAM St=C3=A9phane Marks <<a href=3D"mailto:shipmints@gm= ail.com" target=3D"_blank">shipmints@HIDDEN</a>> wrote:<br></div><blo= ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left= :1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"= ltr"><div class=3D"gmail_default" style=3D"font-family:monospace"><span sty= le=3D"font-family:Arial,Helvetica,sans-serif;background-color:transparent">= On Fri, Sep 11, 2026 at 10:47=E2=80=AFPM Gary Oberbrunner <<a href=3D"ma= ilto:garyo@HIDDEN" target=3D"_blank">garyo@HIDDEN</a>>= wrote:</span></div></div><div class=3D"gmail_quote"><blockquote class=3D"g= mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204= ,204,204);padding-left:1ex"><div dir=3D"ltr"><div>In recent master, `(kill-= all-local-variables 'reset)` doesn't remove any buffer-local bindin= gs. Plain and `t` arguments still do.</div><div><br></div><div>This showed = up for me because I use doom-modeline and any command during which the mode= line is evaluated and a `:eval` form calls `string-pixel-width` deactivate= s the region.=C2=A0 With doom-modeline, the first `C-SPC C-n` in a fresh bu= ffer doesn't get a region set.<br><br>This seems=C2=A0to be because `wo= rk-buffer--release` relies on `'reset` to flush the reusable work buffe= r, and one variable in there is=C2=A0`deactivate-mark`, which becomes buffe= r-local when set and is set by the `add-text-properties` and `erase-buffer`= calls in `work-buffer--prepare-pixelwise` and `work-buffer--release` (only= the `insert` is inside a `let`).<br><br>Recipe (emacs -Q in batch)<br>----= -------------<br>emacs -Q --batch --eval '(progn (transient-mark-mode 1= ) (defun bug () (interactive) (set-mark (point)) (string-pixel-width "= x")) (global-set-key (kbd "C-c b") (function bug)) (with-cur= rent-buffer (generate-new-buffer "t") (insert "abc") (e= xecute-kbd-macro (kbd "C-c b")) (message "mark-active: %S&qu= ot; mark-active)))'<br><br>Expected: mark-active: t<br>Observed: mark-a= ctive: nil</div><div><br>Removing the `string-pixel-width' call gives t= .=C2=A0 Replacing it with `(with-work-buffer (insert "x"))', = or with `(with-current-buffer (get-buffer-create " *k*") (insert = "a") (kill-all-local-variables 'reset))', gives nil again= ; with `(kill-all-local-variables)' or `(kill-all-local-variables t)= 9; in that form it gives t.<br><br>Recipe, interactive (GUI or -nw)<br>----= ----------------------------<br><br>1. emacs -Q<br>2. M-: (global-set-key (= kbd "C-c b") (lambda () (interactive) (set-mark (point)) (forward= -char 3) (string-pixel-width "x"))) RET<br>3. C-x C-f /tmp/anythi= ng.txt RET =C2=A0(an existing file with some text; do not type in the buffe= r)<br>4. C-c b<br>Expected: a three-character region is active and highligh= ted.<br>Observed: no region, `mark-active' is nil.</div><div><br></div>= <div>Note: the problem is masked in any buffer where `deactivate-mark' = has<br>a buffer-local binding, i.e. any buffer that has been edited since i= ts<br>last major-mode change.</div><div><br>Suggested fixes<br>------------= ---<br><br>- Make `(kill-all-local-variables 'reset)` and `'permane= nt-local'<br>=C2=A0 actually remove the local bindings, as documented.= =C2=A0</div><div><br>- Separately, `with-work-buffer' could bind `deact= ivate-mark' for<br>=C2=A0 the whole body plus release, instead of only = around `insert', so<br>=C2=A0 that measuring a string never has this si= de effect regardless of how<br>=C2=A0 the work buffer is flushed:<br><br>= =C2=A0 =C2=A0 =C2=A0 (with-current-buffer ,work-buffer<br>=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (let (deactivate-mark)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (un= wind-protect<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (progn ,@b= ody)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (work-buffer--release ,wo= rk-buffer))))<br><br>Environment<br>-----------<br><br>In GNU Emacs 32.0.50= (build 1, aarch64-apple-darwin25.5.0, NS<br>appkit-2685.60 Version 26.5.2 = (Build 25F84)) of 2026-08-15<br>Repository revision: 73add0e2bfb63ceb39e516= 6c9d3eb2fee7ad0ef3<br>Repository branch: master<br>System: macOS 26.5.2 (Da= rwin 25.5.0), aarch64<br>Features: ACL DBUS GLIB GNUTLS LCMS2 LIBXML2 MODUL= ES NATIVE_COMP NOTIFY<br>KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT= _SCROLL_BARS<br>TREE_SITTER WEBP XIM XWIDGETS ZLIB</div></div></blockquote>= <div><br></div><div class=3D"gmail_default" style=3D"font-family:monospace"= >I think this is the same as=C2=A0<a href=3D"https://debbugs.gnu.org/cgi/bu= greport.cgi?bug=3D81254" target=3D"_blank">https://debbugs.gnu.org/cgi/bugr= eport.cgi?bug=3D81254</a> which has a patch pending for installation.=C2=A0= I'm attaching that patch here.=C2=A0 Please try it and see if it solve= s your issue.</div></div></div> </blockquote></div><div><br clear=3D"all"></div><div><br></div><span class= =3D"gmail_signature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_s= ignature"><div dir=3D"ltr"><div>Gary</div></div></div> </blockquote></div> --000000000000438974065b4a5705--
bug-gnu-emacs@HIDDEN:bug#81849; Package emacs.
Full text available.Received: (at 81849) by debbugs.gnu.org; 12 Sep 2026 14:49:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 12 10:49:47 2026 Received: from localhost ([127.0.0.1]:53063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1x5P35-0000hE-1W for submit <at> debbugs.gnu.org; Sat, 12 Sep 2026 10:49:47 -0400 Received: from mail-ua2-x10.google.com ([2a00:1450:4864:39::10]:55173) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <garyo@HIDDEN>) id 1x5P33-0000gz-36 for 81849 <at> debbugs.gnu.org; Sat, 12 Sep 2026 10:49:46 -0400 Received: by mail-ua2-x10.google.com with SMTP id a1e0cc1a2514c-97e7c7bac31so324982241.1 for <81849 <at> debbugs.gnu.org>; Sat, 12 Sep 2026 07:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1789224579; cv=none; d=google.com; s=arc-20260327; b=EwVuPXq0JbnTaelvUiEbtnTD6/OEIBQWwAXF0GGnhpQILXSQ1Sbf3KwvOWphZpEx/0 /5Ob7/R5n/IWxeCqIfs62hl4iRYXoxwMVQzm/p38REvQfb3fv78mtatXTCObPHrSKra4 S3rSb65I1ZKYGCrSWvNMvMDgIstTWoxnWuqAuaOKEDyZnpPtFGjiN4yKu/ArQEcatxA5 RStjZz5aSz7x+xYNaDa7nviUHA68uAoF2K6ii/KAxOrFReHq03bHVbjJKcfq8OLTpnXk G1aMeqtu4BJnywXv/aPhhSybE4Qb0k7Rc4EDTy+EUAhHD2orrkmc0RNBQuQ40OzSe5PO B7Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=ZvACGA/rP+IU2+A9U0sJEm/PRLKr6KA9xmo08+OnHSw=; fh=FwHnBzwGOAlLyKCvVyLSn5QWxm/qDbci+ORcriOLteQ=; b=I31Sk6UdnODYO6o4HpWZ6XRb8W3HIzsG6n8jqX2BKlfRyFAKu9r8eNJmpXAGCVDNdK hMq9rhFu5RJcbYy49+ROu2e2mu/6MkascdsDWvkH+CKTp+Ev6MVZ2M5V5L5/Uuvhvatq 1cv3SM8GYpdoFQ8eZLcBnIfpOcTTqi5+03zfWYvY2v1cEvoZmZS9H5zELeqeUip73V// at72TXv0ok26K8x2UMl5LjgPScwTH+HR4Mpon9MxFT6qTUFL+AksnEEuvPDYLoZfnyqQ xkiEYMnKrtRx5nooykcnzCGdON61Sb6Km+Bv8kN2K11+OVazlkk7VZPoGQgfmFv+5moh Vyhw==; darn=debbugs.gnu.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oberbrunner.com; s=google; t=1789224579; x=1789829379; darn=debbugs.gnu.org; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZvACGA/rP+IU2+A9U0sJEm/PRLKr6KA9xmo08+OnHSw=; b=IGd/+Td1eRbiEu78BJUoXODQoarHkEygX5P6PeVW6cQthTg0w0NrClBHXGkMhS7aQL 57JIa+1lZx+YkcQJ6QvCWc4xgk7j2ESvZLzC6+xziAnDjkm9eLeFfEczstwNgiGo/2SE QH0mMaS19E3ztsKPWqrQ2jYDFXWVxM5vSurplxNaO+z2nKY8gOfi5khuh1wMWgZSFCIF jicnEUTbeRrDKLiT6yRpt77Y5uxj4G1tKaOkbeLZE4zYHgJ6iCHSQXgwdGCQshn8wtqr gmlVCqVucwseYIvVUGJ31p/Y2a/xb6jkD4q22cymtdk0lmPyN+t2+R+HVPXL1gtRb5jv SGQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789224579; x=1789829379; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=ZvACGA/rP+IU2+A9U0sJEm/PRLKr6KA9xmo08+OnHSw=; b=oB027go5Jl2OnakNnZ+xGDnEP6C82iXdnp/xryUx9Xm8ZpK2Q+LqAGlkrEg5LjnNXa /diCMts1AB/ETqFe1MqCoXlThN06xK0Oec+uHOd1nxmz74FHMsksl/dHnzhZ0bFC/1fa Lwfy8jv3NIjgKbawsMEa0gUdfOfTRJ3BAUpzD/hV7zuCuJcsmwF4/x1ioqlpFNSK3tMa 87b9VWSsKb1UoxNPBQstk5w1H2srTVVIHfKkmo3WVKnlZnev+rrU5kr6+dmOkOyo7OeJ 4/365SnG94ZlaFszacDhYMcAoMDBSu59SzeHNqU2Kk60oX/qvQotquXrrX8v7HljUqes E5lQ== X-Gm-Message-State: AFuF++m2CJ5++N1dom8i17ZP3ViiWrhGUMgV6MkKamMz1dO5T7Z2OtDx 7/lw2aGkOlLLrsCGAjF1AjtkT1ScYkbY0fp6yVXNrKzF61jdzO+sQfGWH+L3BmSdPgWvoAau/l5 PzzgFpSYBTpAYpIXLirGHnutLG+JOgPmdUuYZNhMuM7exlz/1D6xk5sg= X-Gm-Gg: AYBFou1J7Am1c6vvhXhC3FC6ctVZPcvkm5GFCBuOoALMpvtrcyTNobWPgrk9b9qgSqi ptrpYOKLzgFdOV6/52Q5YwUD6CMdz9xI3I3JYKSnmARiDGBAFtv5DFX7L5gQ2zaVb0xVioYVXZ+ kxvng/1Zxp4dRyBPEoxcXaXGKuJtEI0Csr5jo6rrkgXt24PRZc674GcWpomfIHBlyP9Q+k2mbPn jVmvIwHOmLrHryQ5yZoCYTZXDiD3AQ1CpToGw2C9YaL3yPD0ZWWYE+qdwWrRFY181dzXKaBXPGm XvGsCwtjworx5f2QBbr4E4bstHWWdWugrbZVS4OBjIUy5gvPu1bMMApdVEMm3Ekqv0BLRz/oaJB P4eCYVTHlZZsDoKW1sey+WOKBLPq7qHsPXw== X-Received: by 2002:a05:6102:2231:b0:797:78f5:5a31 with SMTP id ada2fe7eead31-79778f55e00mr596508137.0.1789224578764; Sat, 12 Sep 2026 07:49:38 -0700 (PDT) MIME-Version: 1.0 References: <CAFChFyjuZfax3tJ--k17X8oo+BJO41N5PJ5f5bxjAWz3d0FuwQ@HIDDEN> <CAN+1Hbo1SfEn1V5gwXTooHo=MtNZfSoD4OdKW-PGwqOyy=dNjg@HIDDEN> In-Reply-To: <CAN+1Hbo1SfEn1V5gwXTooHo=MtNZfSoD4OdKW-PGwqOyy=dNjg@HIDDEN> From: Gary Oberbrunner <garyo@HIDDEN> Date: Sat, 12 Sep 2026 10:49:27 -0400 X-Gm-Features: AcwNN1WKEz_X8Xu2FNaUGD6uzrIZc_5txWxhdA8DZ8m4JMr6orVrzYzimBGQgTE Message-ID: <CAFChFyinYsSMspGSkEy05X3L-H_W35TzexjFK95v8H-LC_Jbtg@HIDDEN> Subject: Re: bug#81849: 32.0.50; (kill-all-local-variables 'reset) keeps local bindings To: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN> Content-Type: multipart/alternative; boundary="00000000000070e767065b4a4fc9" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 81849 Cc: 81849 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --00000000000070e767065b4a4fc9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks; that patch definitely fixes my issue. Confirmed. -- Gary On Sat, Sep 12, 2026 at 7:17=E2=80=AFAM St=C3=A9phane Marks <shipmints@gmai= l.com> wrote: > On Fri, Sep 11, 2026 at 10:47=E2=80=AFPM Gary Oberbrunner <garyo@oberbrun= ner.com> > wrote: > >> In recent master, `(kill-all-local-variables 'reset)` doesn't remove any >> buffer-local bindings. Plain and `t` arguments still do. >> >> This showed up for me because I use doom-modeline and any command during >> which the mode line is evaluated and a `:eval` form calls >> `string-pixel-width` deactivates the region. With doom-modeline, the fi= rst >> `C-SPC C-n` in a fresh buffer doesn't get a region set. >> >> This seems to be because `work-buffer--release` relies on `'reset` to >> flush the reusable work buffer, and one variable in there >> is `deactivate-mark`, which becomes buffer-local when set and is set by = the >> `add-text-properties` and `erase-buffer` calls in >> `work-buffer--prepare-pixelwise` and `work-buffer--release` (only the >> `insert` is inside a `let`). >> >> Recipe (emacs -Q in batch) >> ----------------- >> emacs -Q --batch --eval '(progn (transient-mark-mode 1) (defun bug () >> (interactive) (set-mark (point)) (string-pixel-width "x")) (global-set-k= ey >> (kbd "C-c b") (function bug)) (with-current-buffer (generate-new-buffer >> "t") (insert "abc") (execute-kbd-macro (kbd "C-c b")) (message >> "mark-active: %S" mark-active)))' >> >> Expected: mark-active: t >> Observed: mark-active: nil >> >> Removing the `string-pixel-width' call gives t. Replacing it with >> `(with-work-buffer (insert "x"))', or with `(with-current-buffer >> (get-buffer-create " *k*") (insert "a") (kill-all-local-variables >> 'reset))', gives nil again; with `(kill-all-local-variables)' or >> `(kill-all-local-variables t)' in that form it gives t. >> >> Recipe, interactive (GUI or -nw) >> -------------------------------- >> >> 1. emacs -Q >> 2. M-: (global-set-key (kbd "C-c b") (lambda () (interactive) (set-mark >> (point)) (forward-char 3) (string-pixel-width "x"))) RET >> 3. C-x C-f /tmp/anything.txt RET (an existing file with some text; do >> not type in the buffer) >> 4. C-c b >> Expected: a three-character region is active and highlighted. >> Observed: no region, `mark-active' is nil. >> >> Note: the problem is masked in any buffer where `deactivate-mark' has >> a buffer-local binding, i.e. any buffer that has been edited since its >> last major-mode change. >> >> Suggested fixes >> --------------- >> >> - Make `(kill-all-local-variables 'reset)` and `'permanent-local' >> actually remove the local bindings, as documented. >> >> - Separately, `with-work-buffer' could bind `deactivate-mark' for >> the whole body plus release, instead of only around `insert', so >> that measuring a string never has this side effect regardless of how >> the work buffer is flushed: >> >> (with-current-buffer ,work-buffer >> (let (deactivate-mark) >> (unwind-protect >> (progn ,@body) >> (work-buffer--release ,work-buffer)))) >> >> Environment >> ----------- >> >> In GNU Emacs 32.0.50 (build 1, aarch64-apple-darwin25.5.0, NS >> appkit-2685.60 Version 26.5.2 (Build 25F84)) of 2026-08-15 >> Repository revision: 73add0e2bfb63ceb39e5166c9d3eb2fee7ad0ef3 >> Repository branch: master >> System: macOS 26.5.2 (Darwin 25.5.0), aarch64 >> Features: ACL DBUS GLIB GNUTLS LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY >> KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS >> TREE_SITTER WEBP XIM XWIDGETS ZLIB >> > > I think this is the same as > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D81254 which has a patch > pending for installation. I'm attaching that patch here. Please try it > and see if it solves your issue. > --=20 Gary --00000000000070e767065b4a4fc9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Thanks; that patch definitely fixes my issue. Confirmed.<d= iv><br></div><div>-- Gary</div></div><br><div class=3D"gmail_quote gmail_qu= ote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Sep 12, 2026 a= t 7:17=E2=80=AFAM St=C3=A9phane Marks <<a href=3D"mailto:shipmints@gmail= .com">shipmints@HIDDEN</a>> wrote:<br></div><blockquote class=3D"gmai= l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20= 4,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gm= ail_default" style=3D"font-family:monospace"><span style=3D"font-family:Ari= al,Helvetica,sans-serif;background-color:transparent">On Fri, Sep 11, 2026 = at 10:47=E2=80=AFPM Gary Oberbrunner <<a href=3D"mailto:garyo@oberbrunne= r.com" target=3D"_blank">garyo@HIDDEN</a>> wrote:</span></div><= /div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"= margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef= t:1ex"><div dir=3D"ltr"><div>In recent master, `(kill-all-local-variables &= #39;reset)` doesn't remove any buffer-local bindings. Plain and `t` arg= uments still do.</div><div><br></div><div>This showed up for me because I u= se doom-modeline and any command during which the mode line is evaluated an= d a `:eval` form calls `string-pixel-width` deactivates the region.=C2=A0 W= ith doom-modeline, the first `C-SPC C-n` in a fresh buffer doesn't get = a region set.<br><br>This seems=C2=A0to be because `work-buffer--release` r= elies on `'reset` to flush the reusable work buffer, and one variable i= n there is=C2=A0`deactivate-mark`, which becomes buffer-local when set and = is set by the `add-text-properties` and `erase-buffer` calls in `work-buffe= r--prepare-pixelwise` and `work-buffer--release` (only the `insert` is insi= de a `let`).<br><br>Recipe (emacs -Q in batch)<br>-----------------<br>emac= s -Q --batch --eval '(progn (transient-mark-mode 1) (defun bug () (inte= ractive) (set-mark (point)) (string-pixel-width "x")) (global-set= -key (kbd "C-c b") (function bug)) (with-current-buffer (generate= -new-buffer "t") (insert "abc") (execute-kbd-macro (kbd= "C-c b")) (message "mark-active: %S" mark-active)))= 9;<br><br>Expected: mark-active: t<br>Observed: mark-active: nil</div><div>= <br>Removing the `string-pixel-width' call gives t.=C2=A0 Replacing it = with `(with-work-buffer (insert "x"))', or with `(with-curren= t-buffer (get-buffer-create " *k*") (insert "a") (kill-= all-local-variables 'reset))', gives nil again; with `(kill-all-loc= al-variables)' or `(kill-all-local-variables t)' in that form it gi= ves t.<br><br>Recipe, interactive (GUI or -nw)<br>-------------------------= -------<br><br>1. emacs -Q<br>2. M-: (global-set-key (kbd "C-c b"= ) (lambda () (interactive) (set-mark (point)) (forward-char 3) (string-pixe= l-width "x"))) RET<br>3. C-x C-f /tmp/anything.txt RET =C2=A0(an = existing file with some text; do not type in the buffer)<br>4. C-c b<br>Exp= ected: a three-character region is active and highlighted.<br>Observed: no = region, `mark-active' is nil.</div><div><br></div><div>Note: the proble= m is masked in any buffer where `deactivate-mark' has<br>a buffer-local= binding, i.e. any buffer that has been edited since its<br>last major-mode= change.</div><div><br>Suggested fixes<br>---------------<br><br>- Make `(k= ill-all-local-variables 'reset)` and `'permanent-local'<br>=C2= =A0 actually remove the local bindings, as documented.=C2=A0</div><div><br>= - Separately, `with-work-buffer' could bind `deactivate-mark' for<b= r>=C2=A0 the whole body plus release, instead of only around `insert', = so<br>=C2=A0 that measuring a string never has this side effect regardless = of how<br>=C2=A0 the work buffer is flushed:<br><br>=C2=A0 =C2=A0 =C2=A0 (w= ith-current-buffer ,work-buffer<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let (deacti= vate-mark)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unwind-protect<br>=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (progn ,@body)<br>=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (work-buffer--release ,work-buffer))))<br><br>E= nvironment<br>-----------<br><br>In GNU Emacs 32.0.50 (build 1, aarch64-app= le-darwin25.5.0, NS<br>appkit-2685.60 Version 26.5.2 (Build 25F84)) of 2026= -08-15<br>Repository revision: 73add0e2bfb63ceb39e5166c9d3eb2fee7ad0ef3<br>= Repository branch: master<br>System: macOS 26.5.2 (Darwin 25.5.0), aarch64<= br>Features: ACL DBUS GLIB GNUTLS LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY<= br>KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS<br>TREE_S= ITTER WEBP XIM XWIDGETS ZLIB</div></div></blockquote><div><br></div><div cl= ass=3D"gmail_default" style=3D"font-family:monospace">I think this is the s= ame as=C2=A0<a href=3D"https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8125= 4" target=3D"_blank">https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D81254<= /a> which has a patch pending for installation.=C2=A0 I'm attaching tha= t patch here.=C2=A0 Please try it and see if it solves your issue.</div></d= iv></div> </blockquote></div><div><br clear=3D"all"></div><div><br></div><span class= =3D"gmail_signature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_s= ignature"><div dir=3D"ltr"><div>Gary</div></div></div> --00000000000070e767065b4a4fc9--
bug-gnu-emacs@HIDDEN:bug#81849; Package emacs.
Full text available.Received: (at 81849) by debbugs.gnu.org; 12 Sep 2026 11:17:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 12 07:17:17 2026 Received: from localhost ([127.0.0.1]:36190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1x5LjQ-00082P-GC for submit <at> debbugs.gnu.org; Sat, 12 Sep 2026 07:17:17 -0400 Received: from mail-vs2-x0f.google.com ([2a00:1450:4864:3a::f]:36333) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>) id 1x5LjN-000827-G8 for 81849 <at> debbugs.gnu.org; Sat, 12 Sep 2026 07:17:14 -0400 Received: by mail-vs2-x0f.google.com with SMTP id ada2fe7eead31-78ffc0e2f23so120082137.0 for <81849 <at> debbugs.gnu.org>; Sat, 12 Sep 2026 04:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1789211828; cv=none; d=google.com; s=arc-20260327; b=JBtfoJ/qpCaWC+C5OxEGexd9jZZaUxRUXoWaO9X4IABwSZiP4hiOz72pBpYc6v3URA 7eGT/6nrk5KvW/RcYR8g29hHOaMmtdpGlGghkTvHEPdr08fv0HwugyXQIiDj3dKaMG/E kMpmhRdypsFBH37AajYQjlLzfAWOmc3krwmTq9TGE3SklrTSY7Hb7olYiV/6EWl6viQi hVFrNCwqm7xIqH0+QdAgD7gLq6LrWeGXFoRI7m62p4IAomHFzgIrgTw/aQps8HHYM6UG HMcXo1kNBHhq6GWIAckplhiTRFqwcrMs/aQSO7UdMgVdRWLcrbGgS9OdReBFlelsqBl8 5egA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=lMhhrGeD7Mh7gGSs1KyKbyYnPqeWD0AxS5bMNitanF0=; fh=7R5OF2maqPRuoRcbTe7eDtMTPVtYRl8ssR+trG9g/LE=; b=EoY5UygFruxF+my4ElQfaOBNV/abSIwjTIvE/oE5zJGXBnRBrs2KMSFYXP+KkRTtOr 1VH2eq27dSDXHMkDHxqeCArCTBeXsm5UIS/RpjK+IkHdm+7HRXppdsoRF6vj3SDs0W32 sBHCmlt90txc92scIqHyxmXVJmUAiHgGalZWSbjepZ3xp3KY3j9CxO4RYurbVjliWTJw 1tMvKkEG23It39sec4PG/Pir530z2WRMBwU9/uqsCoqxRnwJLrCEpIgOaWJ884zk/sM+ YFhgwdEYALmb60Y6NLo1o+VhjjMXva+vVHAEmAXLTZIS2eDROuHWSzZlON/3zjIvV53Z zSHg==; darn=debbugs.gnu.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789211828; x=1789816628; darn=debbugs.gnu.org; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:from:to:cc:subject:date:message-id:reply-to :content-type; bh=lMhhrGeD7Mh7gGSs1KyKbyYnPqeWD0AxS5bMNitanF0=; b=bQ4t7sCeq2Sz7bGLxElhkEnAW/azK+vuHowj+d7mHUwqprWcRjFYvC5ZRhS883VOJh hmXEoAruyvYdOmjnDHi5mB3bxRlgjFdcXQAM/CleuHFMVZi3lzUcYUT0cxtP1vwTydBa 8GSnlfhRdwH1jmItO1aidB9W5riSqD7avK6W3xGoHcmUOkZvMnlbrCdHuRTYyHN7S/Xb daGtlWzu9RBcnEVZq3b3LjXn3Wl2paBC/RVzKjsyo9IK4l3jqtJNkPHfFSjamjnyP4pQ Bi2wvAQ9CSxQr6LRgEujpvBK4Fy2jRdkT7T1cPaF1MvjgDqpC+0XMBPo70SVgGqVLqw3 P/7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789211828; x=1789816628; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=lMhhrGeD7Mh7gGSs1KyKbyYnPqeWD0AxS5bMNitanF0=; b=rumbw2BrVb6NR3QWM+DJxh74+sP0f/jOlNaj8ny3+nN+2Ke+pCadggHtNtCOZirlV+ aFK8vqTBO5OyCRAHT4M3GhpQzyAJIYN7t+3NsGRRKFwGe5gLWmz+YjVPgVNntbS4DLHz tUBAKyMSFq9eJgnR7mSpKxqt4Wpn2M91dUoLWQQxSuJI4qHMUAF2APDjyZuWzUI7TeOQ 1ZluSHQkzO4okYNXL+64yvmatHquA0w4gYLRHBWwn5u75rA5igITnHjp25zbSatMNsiH PhQCkHk9ENN+cOsjgQ3gA9YvvT2yhIkhW75BY6+/4iSu4tbjEKvdqfeG/dDqFQrDexlq GA+Q== X-Gm-Message-State: AFuF++lmiSSPcRFhzlqGaPX34sxcQ1WhFX27V0yHtJNriW1Oq+Wi6d9u C5y//bZBvCY30XHmrUCnVsKEbluKM4IBX6gD0C2T71+S/UAzZLPaMZUKa/cepbBQBNQP5Ppp5xg votGyBvHy6G4g3MbvalodtV7KtQUEZqM= X-Gm-Gg: AYBFou1YUcTOAazXAPxm6YLWKWXHNeubFLnAYmtR+Z/dOLK3wRGInZMIw0Dj+lwMOH2 n4szv0E701WO3NHoIcJ71mg67LKcSO1VfuRshm93qJSgVt+EY7Q3twuY6BIdTesbvOFigqhUGpa OKtoRPRSuW4wijz0thMc+w9GPs2WoMEP/5nSAawVZTOurbc+tJ/2aRvbWnU3pQ5T6PsJWISQTcc M0riy/GbDMOuJMgRpbGU/08sxU2CC/Rg93T+y/cA+MYoKPoVx6z9yPGkERDriMCsjGzwrrZUUcO bs4rYWWWNIkt/FyCBhAulir08YcgAKEMi8g12RMK3GzhzYiHcn1PNJoVqmsIikVOqSXYGudsiJg 0GX2ET7nH7s1uehCCO85tBOTa2Ge1o/jAE26NBNk71U7CDZeVoo8fhbc0O6tCc+Ap5pDjJrkmrN oVvS/igUH2sK66Zq/6Zk+XkbALMlYTsTnh81ZZsu1rvvRq++Yi5kMzior0qI7WU5VlLR2kf3FSo qRdvg== X-Received: by 2002:a05:6102:c8f:b0:78f:7135:b4ff with SMTP id ada2fe7eead31-795a65b013dmr1558658137.2.1789211822702; Sat, 12 Sep 2026 04:17:02 -0700 (PDT) MIME-Version: 1.0 References: <CAFChFyjuZfax3tJ--k17X8oo+BJO41N5PJ5f5bxjAWz3d0FuwQ@HIDDEN> In-Reply-To: <CAFChFyjuZfax3tJ--k17X8oo+BJO41N5PJ5f5bxjAWz3d0FuwQ@HIDDEN> From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN> Date: Sat, 12 Sep 2026 07:16:51 -0400 X-Gm-Features: AcwNN1UMOhJT4R4rWGaP2PFb4KqDg4wEpZsO-QBfEIWofhp28-AGFAHRU-IAB48 Message-ID: <CAN+1Hbo1SfEn1V5gwXTooHo=MtNZfSoD4OdKW-PGwqOyy=dNjg@HIDDEN> Subject: Re: bug#81849: 32.0.50; (kill-all-local-variables 'reset) keeps local bindings To: Gary Oberbrunner <garyo@HIDDEN> Content-Type: multipart/mixed; boundary="0000000000001ee0d7065b475763" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 81849 Cc: 81849 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) --0000000000001ee0d7065b475763 Content-Type: multipart/alternative; boundary="0000000000001ee0d5065b475761" --0000000000001ee0d5065b475761 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Sep 11, 2026 at 10:47=E2=80=AFPM Gary Oberbrunner <garyo@oberbrunne= r.com> wrote: > In recent master, `(kill-all-local-variables 'reset)` doesn't remove any > buffer-local bindings. Plain and `t` arguments still do. > > This showed up for me because I use doom-modeline and any command during > which the mode line is evaluated and a `:eval` form calls > `string-pixel-width` deactivates the region. With doom-modeline, the fir= st > `C-SPC C-n` in a fresh buffer doesn't get a region set. > > This seems to be because `work-buffer--release` relies on `'reset` to > flush the reusable work buffer, and one variable in there > is `deactivate-mark`, which becomes buffer-local when set and is set by t= he > `add-text-properties` and `erase-buffer` calls in > `work-buffer--prepare-pixelwise` and `work-buffer--release` (only the > `insert` is inside a `let`). > > Recipe (emacs -Q in batch) > ----------------- > emacs -Q --batch --eval '(progn (transient-mark-mode 1) (defun bug () > (interactive) (set-mark (point)) (string-pixel-width "x")) (global-set-ke= y > (kbd "C-c b") (function bug)) (with-current-buffer (generate-new-buffer > "t") (insert "abc") (execute-kbd-macro (kbd "C-c b")) (message > "mark-active: %S" mark-active)))' > > Expected: mark-active: t > Observed: mark-active: nil > > Removing the `string-pixel-width' call gives t. Replacing it with > `(with-work-buffer (insert "x"))', or with `(with-current-buffer > (get-buffer-create " *k*") (insert "a") (kill-all-local-variables > 'reset))', gives nil again; with `(kill-all-local-variables)' or > `(kill-all-local-variables t)' in that form it gives t. > > Recipe, interactive (GUI or -nw) > -------------------------------- > > 1. emacs -Q > 2. M-: (global-set-key (kbd "C-c b") (lambda () (interactive) (set-mark > (point)) (forward-char 3) (string-pixel-width "x"))) RET > 3. C-x C-f /tmp/anything.txt RET (an existing file with some text; do no= t > type in the buffer) > 4. C-c b > Expected: a three-character region is active and highlighted. > Observed: no region, `mark-active' is nil. > > Note: the problem is masked in any buffer where `deactivate-mark' has > a buffer-local binding, i.e. any buffer that has been edited since its > last major-mode change. > > Suggested fixes > --------------- > > - Make `(kill-all-local-variables 'reset)` and `'permanent-local' > actually remove the local bindings, as documented. > > - Separately, `with-work-buffer' could bind `deactivate-mark' for > the whole body plus release, instead of only around `insert', so > that measuring a string never has this side effect regardless of how > the work buffer is flushed: > > (with-current-buffer ,work-buffer > (let (deactivate-mark) > (unwind-protect > (progn ,@body) > (work-buffer--release ,work-buffer)))) > > Environment > ----------- > > In GNU Emacs 32.0.50 (build 1, aarch64-apple-darwin25.5.0, NS > appkit-2685.60 Version 26.5.2 (Build 25F84)) of 2026-08-15 > Repository revision: 73add0e2bfb63ceb39e5166c9d3eb2fee7ad0ef3 > Repository branch: master > System: macOS 26.5.2 (Darwin 25.5.0), aarch64 > Features: ACL DBUS GLIB GNUTLS LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY > KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS > TREE_SITTER WEBP XIM XWIDGETS ZLIB > I think this is the same as https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D81254 which has a patch pending for installation. I'm attaching that patch here. Please try it and see if it solves your issue. --0000000000001ee0d5065b475761 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon= t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif;b= ackground-color:transparent">On Fri, Sep 11, 2026 at 10:47=E2=80=AFPM Gary = Oberbrunner <<a href=3D"mailto:garyo@HIDDEN">garyo@oberbrunner.= com</a>> wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_= container"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.= 8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"lt= r"><div>In recent master, `(kill-all-local-variables 'reset)` doesn'= ;t remove any buffer-local bindings. Plain and `t` arguments still do.</div= ><div><br></div><div>This showed up for me because I use doom-modeline and = any command during which the mode line is evaluated and a `:eval` form call= s `string-pixel-width` deactivates the region.=C2=A0 With doom-modeline, th= e first `C-SPC C-n` in a fresh buffer doesn't get a region set.<br><br>= This seems=C2=A0to be because `work-buffer--release` relies on `'reset`= to flush the reusable work buffer, and one variable in there is=C2=A0`deac= tivate-mark`, which becomes buffer-local when set and is set by the `add-te= xt-properties` and `erase-buffer` calls in `work-buffer--prepare-pixelwise`= and `work-buffer--release` (only the `insert` is inside a `let`).<br><br>R= ecipe (emacs -Q in batch)<br>-----------------<br>emacs -Q --batch --eval &= #39;(progn (transient-mark-mode 1) (defun bug () (interactive) (set-mark (p= oint)) (string-pixel-width "x")) (global-set-key (kbd "C-c b= ") (function bug)) (with-current-buffer (generate-new-buffer "t&q= uot;) (insert "abc") (execute-kbd-macro (kbd "C-c b")) = (message "mark-active: %S" mark-active)))'<br><br>Expected: m= ark-active: t<br>Observed: mark-active: nil</div><div><br>Removing the `str= ing-pixel-width' call gives t.=C2=A0 Replacing it with `(with-work-buff= er (insert "x"))', or with `(with-current-buffer (get-buffer-= create " *k*") (insert "a") (kill-all-local-variables &= #39;reset))', gives nil again; with `(kill-all-local-variables)' or= `(kill-all-local-variables t)' in that form it gives t.<br><br>Recipe,= interactive (GUI or -nw)<br>--------------------------------<br><br>1. ema= cs -Q<br>2. M-: (global-set-key (kbd "C-c b") (lambda () (interac= tive) (set-mark (point)) (forward-char 3) (string-pixel-width "x"= ))) RET<br>3. C-x C-f /tmp/anything.txt RET =C2=A0(an existing file with so= me text; do not type in the buffer)<br>4. C-c b<br>Expected: a three-charac= ter region is active and highlighted.<br>Observed: no region, `mark-active&= #39; is nil.</div><div><br></div><div>Note: the problem is masked in any bu= ffer where `deactivate-mark' has<br>a buffer-local binding, i.e. any bu= ffer that has been edited since its<br>last major-mode change.</div><div><b= r>Suggested fixes<br>---------------<br><br>- Make `(kill-all-local-variabl= es 'reset)` and `'permanent-local'<br>=C2=A0 actually remove th= e local bindings, as documented.=C2=A0</div><div><br>- Separately, `with-wo= rk-buffer' could bind `deactivate-mark' for<br>=C2=A0 the whole bod= y plus release, instead of only around `insert', so<br>=C2=A0 that meas= uring a string never has this side effect regardless of how<br>=C2=A0 the w= ork buffer is flushed:<br><br>=C2=A0 =C2=A0 =C2=A0 (with-current-buffer ,wo= rk-buffer<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let (deactivate-mark)<br>=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unwind-protect<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (progn ,@body)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (work-buffer--release ,work-buffer))))<br><br>Environment<br>-------= ----<br><br>In GNU Emacs 32.0.50 (build 1, aarch64-apple-darwin25.5.0, NS<b= r>appkit-2685.60 Version 26.5.2 (Build 25F84)) of 2026-08-15<br>Repository = revision: 73add0e2bfb63ceb39e5166c9d3eb2fee7ad0ef3<br>Repository branch: ma= ster<br>System: macOS 26.5.2 (Darwin 25.5.0), aarch64<br>Features: ACL DBUS= GLIB GNUTLS LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY<br>KQUEUE NS PDUMPER = PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS<br>TREE_SITTER WEBP XIM XWIDGE= TS ZLIB</div></div></blockquote><div><br></div><div class=3D"gmail_default"= style=3D"font-family:monospace">I think this is the same as=C2=A0<a href= =3D"https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D81254">https://debbugs.= gnu.org/cgi/bugreport.cgi?bug=3D81254</a> which has a patch pending for ins= tallation.=C2=A0 I'm attaching that patch here.=C2=A0 Please try it and= see if it solves your issue.</div></div></div> --0000000000001ee0d5065b475761-- --0000000000001ee0d7065b475763 Content-Type: application/octet-stream; name="0001-Improve-reset_buffer_local_variables-bug-81254.patch" Content-Disposition: attachment; filename="0001-Improve-reset_buffer_local_variables-bug-81254.patch" Content-Transfer-Encoding: base64 Content-ID: <f_mtyai4kr0> X-Attachment-Id: f_mtyai4kr0 RnJvbSBlODU2OTNhMjc4NjZiZGI0OWUzYmM0ZDk4OTA0ZGEwNzI3ZDNlOTE0IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/U3Q9QzM9QTlwaGFuZT0yME1hcmtzPz0gPHNo aXBtaW50c0BnbWFpbC5jb20+CkRhdGU6IFdlZCwgMjQgSnVuIDIwMjYgMTI6NDU6MjQgLTA0MDAK U3ViamVjdDogW1BBVENIXSBJbXByb3ZlICdyZXNldF9idWZmZXJfbG9jYWxfdmFyaWFibGVzJyAo YnVnIzgxMjU0KQoKU3dhcCBsb2NhbCBiaW5kaW5ncyB0byBnbG9iYWwgc2NvcGUgaW4gYWR2YW5j ZSBvZiByZXNldCB0byBndWFyZAphZ2FpbnN0IHNpZGUgZWZmZWN0cyBmcm9tIHJlZmVyZW5jZXMg dG8gbG9jYWxzLiAgU2VlIGFsc28KYnVnIzc0MDkxIGJ1ZyM4MTExMS4KCiogc3JjL2J1ZmZlci5j IChyZXNldF9idWZmZXJfbG9jYWxfdmFyaWFibGVzKTogU3dhcCB0byBnbG9iYWwKYmluZGluZ3Mg aW4gdGhlICdwZXJtYW5lbnRfdG9vPT0xJyBjb2RlIHBhdGggYmVmb3JlCidic2V0X2xvY2FsX3Zh cl9hbGlzdCcuICBOb3RlOiBUaGlzIGlzIGFscmVhZHkgZG9uZSBpbiB0aGUKJ3Blcm1hbmVudF90 b289PTInIGNvZGUgcGF0aC4KKiB0ZXN0L3NyYy9kYXRhLXRlc3RzLmVsIChkYXRhLXRlc3RzLWtp bGwtYWxsLWxvY2FsLXZhcmlhYmxlcy1yZXNldApkYXRhLXRlc3RzLWtpbGwtYWxsLWxvY2FsLXZh cmlhYmxlcy1wZXJtYW5lbnQtbG9jYWwpOiBOZXcgdGVzdHMuCi0tLQogc3JjL2J1ZmZlci5jICAg ICAgICAgICB8IDIyICsrKysrKysrKysrKysrKysrLS0tLS0KIHRlc3Qvc3JjL2RhdGEtdGVzdHMu ZWwgfCAzNiArKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysKIDIgZmlsZXMgY2hh bmdlZCwgNTMgaW5zZXJ0aW9ucygrKSwgNSBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9zcmMv YnVmZmVyLmMgYi9zcmMvYnVmZmVyLmMKaW5kZXggODEyYzgyZjQzYmQuLjIyMDljZGRjMTZlIDEw MDY0NAotLS0gYS9zcmMvYnVmZmVyLmMKKysrIGIvc3JjL2J1ZmZlci5jCkBAIC0xMTM2LDYgKzEx MzYsOSBAQCByZXNldF9idWZmZXIgKHJlZ2lzdGVyIHN0cnVjdCBidWZmZXIgKmIpCiByZXNldF9i dWZmZXJfbG9jYWxfdmFyaWFibGVzIChzdHJ1Y3QgYnVmZmVyICpiLCBpbnQgcGVybWFuZW50X3Rv bykKIHsKICAgaW50IG9mZnNldCwgaTsKKyAgTGlzcF9PYmplY3QgdG1wID0gUW5pbDsKKyAgTGlz cF9PYmplY3QgYnVmZmVyOworICBYU0VUQlVGRkVSIChidWZmZXIsIGIpOwogCiAgIC8qIFJlc2V0 IHRoZSBtYWpvciBtb2RlIHRvIEZ1bmRhbWVudGFsLCB0b2dldGhlciB3aXRoIGFsbCB0aGUKICAg ICAgdGhpbmdzIHRoYXQgZGVwZW5kIG9uIHRoZSBtYWpvciBtb2RlLgpAQCAtMTE2MCwxMyArMTE2 MywyMiBAQCByZXNldF9idWZmZXJfbG9jYWxfdmFyaWFibGVzIChzdHJ1Y3QgYnVmZmVyICpiLCBp bnQgcGVybWFuZW50X3RvbykKIAogICAvKiBSZXNldCBhbGwgKG9yIG1vc3QpIHBlci1idWZmZXIg dmFyaWFibGVzIHRvIHRoZWlyIGRlZmF1bHRzLiAgKi8KICAgaWYgKHBlcm1hbmVudF90b28gPT0g MSkKLSAgICBic2V0X2xvY2FsX3Zhcl9hbGlzdCAoYiwgUW5pbCk7CisgICAgeworICAgICAgZm9y ICh0bXAgPSBCVkFSIChiLCBsb2NhbF92YXJfYWxpc3QpOyBDT05TUCAodG1wKTsgdG1wID0gWENE UiAodG1wKSkKKyAgICAgICAgeworICAgICAgICAgIExpc3BfT2JqZWN0IHN5bSA9IFhDQVIgKFhD QVIgKHRtcCkpOworICAgICAgICAgIGlmIChCQVNFX0VRIChTWU1CT0xfQkxWIChYU1lNQk9MIChz eW0pKS0+d2hlcmUsIGJ1ZmZlcikpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIC8qIFN5 bWJvbCBpcyBzZXQgdXAgZm9yIHRoaXMgYnVmZmVyJ3Mgb2xkIGxvY2FsIHZhbHVlOgorICAgICAg ICAgICAgICAgICBzd2FwIGl0IG91dCEgICovCisgICAgICAgICAgICAgIHN3YXBfaW5fZ2xvYmFs X2JpbmRpbmcgKFhTWU1CT0wgKHN5bSkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAg ICBic2V0X2xvY2FsX3Zhcl9hbGlzdCAoYiwgUW5pbCk7CisgICAgfQogICBlbHNlCiAgICAgewot ICAgICAgTGlzcF9PYmplY3QgdG1wLCBsYXN0ID0gUW5pbDsKLSAgICAgIExpc3BfT2JqZWN0IGJ1 ZmZlcjsKLSAgICAgIFhTRVRCVUZGRVIgKGJ1ZmZlciwgYik7Ci0KKyAgICAgIExpc3BfT2JqZWN0 IGxhc3QgPSBRbmlsOwogICAgICAgZm9yICh0bXAgPSBCVkFSIChiLCBsb2NhbF92YXJfYWxpc3Qp OyBDT05TUCAodG1wKTsgdG1wID0gWENEUiAodG1wKSkKICAgICAgICAgewogICAgICAgICAgIExp c3BfT2JqZWN0IGxvY2FsX3ZhciA9IFhDQVIgKFhDQVIgKHRtcCkpOwpkaWZmIC0tZ2l0IGEvdGVz dC9zcmMvZGF0YS10ZXN0cy5lbCBiL3Rlc3Qvc3JjL2RhdGEtdGVzdHMuZWwKaW5kZXggMmZjOTcx ZDAyMTQuLmE1NGQ0NmYwMGY3IDEwMDY0NAotLS0gYS90ZXN0L3NyYy9kYXRhLXRlc3RzLmVsCisr KyBiL3Rlc3Qvc3JjL2RhdGEtdGVzdHMuZWwKQEAgLTY1Myw2ICs2NTMsNDIgQEAgZGF0YS10ZXN0 cy1raWxsLWFsbC1sb2NhbC12YXJpYWJsZXMKICAgICAgICAgICAgICAgICAgICAgICAgKGJvdW5k LWFuZC10cnVlLXAgZGF0YS10ZXN0cy1mb28yKQogICAgICAgICAgICAgICAgICAgICAgICAoYm91 bmQtYW5kLXRydWUtcCBkYXRhLXRlc3RzLWZvbzMpKSkpKSkpCiAKKyhlcnQtZGVmdGVzdCBkYXRh LXRlc3RzLWtpbGwtYWxsLWxvY2FsLXZhcmlhYmxlcy1yZXNldCAoKQorICA7OyBidWcjODExMTEK KyAgKHVud2luZC1wcm90ZWN0CisgICAgICAod2l0aC10ZW1wLWJ1ZmZlcgorICAgICAgICAobWFr ZS1sb2NhbC12YXJpYWJsZSAnZm9vKQorICAgICAgICAocHV0ICdmb28gJ3Blcm1hbmVudC1sb2Nh bCB0KQorICAgICAgICAoc2V0cSBmb28gJ2JhcikKKyAgICAgICAgKHNldHEgYnVmZmVyLWZpbGUt bmFtZSAiL2R1bW15IikKKyAgICAgICAgKGtpbGwtYWxsLWxvY2FsLXZhcmlhYmxlcyAncmVzZXQp CisgICAgICAgIChzaG91bGQtbm90IChsb2NhbC12YXJpYWJsZS1wICdmb28pKQorICAgICAgICAo c2hvdWxkLW5vdCBidWZmZXItZmlsZS1uYW1lKSkKKyAgICAobWFrdW5ib3VuZCAnZm9vKSkpCisK KyhlcnQtZGVmdGVzdCBkYXRhLXRlc3RzLWtpbGwtYWxsLWxvY2FsLXZhcmlhYmxlcy1wZXJtYW5l bnQtbG9jYWwgKCkKKyAgOzsgYnVnIzgxMjU0IGJ1ZyM4MTExMSBidWcjNzQwOTEKKyAgKHVud2lu ZC1wcm90ZWN0CisgICAgICAod2l0aC10ZW1wLWJ1ZmZlcgorICAgICAgICAoc2hvdWxkIChlcXVh bAorICAgICAgICAgICAgICAgICAobGlzdCAoc2V0cS1kZWZhdWx0IGZvbyAxMjMpCisgICAgICAg ICAgICAgICAgICAgICAgIChzZXRxLWxvY2FsIGZvbyB0KQorICAgICAgICAgICAgICAgICAgICAg ICAoa2lsbC1hbGwtbG9jYWwtdmFyaWFibGVzICdwZXJtYW5lbnQtbG9jYWwpCisgICAgICAgICAg ICAgICAgICAgICAgIChsb2NhbC12YXJpYWJsZS1wICdmb28pCisgICAgICAgICAgICAgICAgICAg ICAgIGZvbworICAgICAgICAgICAgICAgICAgICAgICAoZGVmYXVsdC12YWx1ZSAnZm9vKQorICAg ICAgICAgICAgICAgICAgICAgICAod2l0aC10ZW1wLWJ1ZmZlciBmb28pCisgICAgICAgICAgICAg ICAgICAgICAgIGZvbykKKyAgICAgICAgICAgICAgICAgKGxpc3QgMTIzCisgICAgICAgICAgICAg ICAgICAgICAgIHQKKyAgICAgICAgICAgICAgICAgICAgICAgbmlsCisgICAgICAgICAgICAgICAg ICAgICAgIG5pbAorICAgICAgICAgICAgICAgICAgICAgICAxMjMKKyAgICAgICAgICAgICAgICAg ICAgICAgMTIzCisgICAgICAgICAgICAgICAgICAgICAgIDEyMworICAgICAgICAgICAgICAgICAg ICAgICAxMjMpKSkpCisgICAgKG1ha3VuYm91bmQgJ2ZvbykpKQorCiAoZXJ0LWRlZnRlc3QgZGF0 YS10ZXN0cy1iaWdudW0gKCkKICAgKHNob3VsZCAoYmlnbnVtcCAoKyBtb3N0LXBvc2l0aXZlLWZp eG51bSAxKSkpCiAgIChsZXQgKChmMCAoKyAoZmxvYXQgbW9zdC1wb3NpdGl2ZS1maXhudW0pIDEp KQotLSAKMi41NC4wCgo= --0000000000001ee0d7065b475763--
bug-gnu-emacs@HIDDEN:bug#81849; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 12 Sep 2026 02:46:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 11 22:46:43 2026
Received: from localhost ([127.0.0.1]:49017 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1x5DlK-0004Mo-LJ
for submit <at> debbugs.gnu.org; Fri, 11 Sep 2026 22:46:43 -0400
Received: from lists1p.gnu.org ([2001:470:142::17]:45412)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <garyo@HIDDEN>)
id 1x5DlG-0004MA-KZ
for submit <at> debbugs.gnu.org; Fri, 11 Sep 2026 22:46:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <garyo@HIDDEN>)
id 1x5Dky-00018M-MP
for bug-gnu-emacs@HIDDEN; Fri, 11 Sep 2026 22:46:21 -0400
Received: from mail-vs2-x1f.google.com ([2a00:1450:4864:3a::1f])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <garyo@HIDDEN>)
id 1x5Dkw-0001vo-Cr
for bug-gnu-emacs@HIDDEN; Fri, 11 Sep 2026 22:46:20 -0400
Received: by mail-vs2-x1f.google.com with SMTP id
71dfb90a1353d-5c963d7503fso153155e0c.0
for <bug-gnu-emacs@HIDDEN>; Fri, 11 Sep 2026 19:46:16 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1789181175; cv=none;
d=google.com; s=arc-20260327;
b=iToyvWckgu3xqJLajimVMUDXmUdy7eCeFAm6izQFgHdl9s9zYBpSVdGy7d5R/LmMR5
YmpHD7I5/F4nyH6IZPTh7oukBmzs4FCMxG/Lh8+MtjmuMz3CqS3dzq+pSVHEf7b9NZx7
IEOiBIt+POjRcphelHero6F+lkKuKKbgQVY63ixoz+k0YmcXpNiG9LPDnDR3RiO81Lsl
PAf3hadFvtDNMIXfyrDtynyRtyZlrCTLFj5npeBc9pWtqprPU/WgbrKfZMmGGC3NMPjc
Nfb9L//vUrO3MDCGJ5kBchARvS+bLKfOvppgjMRuSo0EqAFJ5w4eLhAvWOj5uENZ5yqJ
fdUQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20260327;
h=to:subject:message-id:date:from:mime-version:dkim-signature;
bh=vB47QLLCVpU8rhAtzkuYr4E3wBhb6K77qbyiMFmKuUk=;
fh=+R8aXOFVnuBbN1nRXJJI02Ia//JUQJmLW/Uk/VaA0ag=;
b=jMSZNe5v0yvh91z+3/OFtWgkSjQ5tPmRjxU6wIAObtpw1smjs5dHDpTQWO3l/9JZ7i
JVcQ4YF4RC/GDon3apzZaxKMmroFIgr17+p+2k2Tm/wjZpV5WdeMEy2hEzmjSq0B0p3U
tvpjoeybKtziS80zNqW4nzScfPXRNMJMh4xJQZ3ebfeBf26xUmnp3n/eLOOV0SvcLaqe
V7xr9Nol1VjKhC4lCBZ90xM9PnrdPfr1NtBFntfXwTei3dGd2TuYh8lVYvDFqVistN8G
PjMRTG/N1MBgAtqv44GMt6v3UIorW/d4cd5q+fQLOeg63JTyidlNHsSJvi/jXuZteZ8A
jFzw==; darn=gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oberbrunner.com; s=google; t=1789181175; x=1789785975; darn=gnu.org;
h=content-type:to:subject:message-id:date:from:mime-version:from:to
:cc:subject:date:message-id:reply-to:content-type;
bh=vB47QLLCVpU8rhAtzkuYr4E3wBhb6K77qbyiMFmKuUk=;
b=dH4JyG3AiAk9sj30BaEyiiXQHEfHMdXuubzXNV7WhbvS7G46Ss3qv2N23MpqbLJksv
GDQO/geSQBmfWjNcZnyImBlpzRTMf/WMpHs0hz67F9abFV5tIDcDhaGONowxLr6jsT+5
/x3VVN+zsgs2aQ/iLXaQkUKbjyIj16FtwFTNxD/jgcF4eOuWBIewIufHfKQN1q4pDpLS
bwFh/YLF8Nf7vcNZ1OHhcyIkJPMB77Hod2Cw3lfXRKz5g6BUs8dAKDxfHHFhNHi3Lv7u
u8JOEj7ZNy9wIXttMTyUU4VVIFDfDabtt/TW6NBwa4GyQOqA6gRKl4jB4u1s8wl42AxE
Wa/Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1789181175; x=1789785975;
h=content-type:to:subject:message-id:date:from:mime-version:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=vB47QLLCVpU8rhAtzkuYr4E3wBhb6K77qbyiMFmKuUk=;
b=sFtT927d9MygQQd+w/gjMiHQwi0pqoFWQglF2jPwHn8/wsABS6qnXtBLTg8EO9yrsV
SICyZNOt1VnfJCW3Dv85eQZRTGgKAy3ftC0HRRKsxlqLdy8qx6XBsFlZA8PFKXNzTlmh
TVJthbn+R7R+tID+mNxgU7MedHGpjNfmPB4jUpmRNP/rKIv69oxsacXrYvg0TKcQg23Z
OFtVxpzCb24eZupA4+AYsFDM7yBAHi/F0VEpai2JLPucijob89pPV79zXcd0/Nc3mifY
TlaHZJw4Nhu6y6KEus7tdg29EfHS5bb5u2STYGV+WKstlmZPm+BY2EQarYYF1kwq4AvM
8/MQ==
X-Gm-Message-State: AFuF++ltyS/+hGNApBIDfTl7H9hSNRB9GdRLwQTKZvWk2fHb7Pon+4mL
dFLheASlKXnL9CmPpJmAMieOxBMEBqb+2eYewW18PTM8acCvk+fr//89XbkcmI8ETcJqV8OzQPn
fZ4k+MHXj/CO5PsBSkfUu7DlaI8O9u6wmTw/BSZIH4hYNNmZ/LG+t6GOIPw==
X-Gm-Gg: AYBFou184l3+c0pf3DgxQ01rwYbjvxDWQp7EabQd3PnmSJNYT80ssEXaXk/z7hi+tFy
zj4VO05DBNDtR+P9HKOMFnEypRXf8UfkklWZICeoYncDdJA971XAArOeW/MHDYJlUDFZkqWaZfU
psr2zuDSjsjvPwWxSeB7kuKFw3OKDGbKJFGbdCfIWvfsj//YFNHnq5vpEAyqm8UHFLmeYNn32f7
7A5Xn0v92JQOWG2KYpqxRrSn3KuUx2kawJ9ZcC+BHoip9EKh71Eh7cZv2SPXNK+nMGkYGkDNFXF
esSE5rcLB72V2IfusmHsv2LUIfjDFQVFdmsyKQOZq38taxLgMV1sO/ahougoNB1UewYh76y0BC2
XQbkAYMz+x6BZxAiaa1shseVPlWQPtAePumJa5COlaLtR
X-Received: by 2002:a05:6102:41a6:b0:790:5c56:bd62 with SMTP id
ada2fe7eead31-792ade901d5mr2668783137.13.1789181174551; Fri, 11 Sep 2026
19:46:14 -0700 (PDT)
MIME-Version: 1.0
From: Gary Oberbrunner <garyo@HIDDEN>
Date: Fri, 11 Sep 2026 22:46:03 -0400
X-Gm-Features: AcwNN1VSLcXKdAgwMyAva3Xl2SaTE2iFnwyfVRFcw1P9YF74koDoAOBhuwPiPY4
Message-ID: <CAFChFyjuZfax3tJ--k17X8oo+BJO41N5PJ5f5bxjAWz3d0FuwQ@HIDDEN>
Subject: 32.0.50; (kill-all-local-variables 'reset) keeps local bindings
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000592715065b4034e0"
Received-SPF: pass client-ip=2a00:1450:4864:3a::1f;
envelope-from=garyo@HIDDEN; helo=mail-vs2-x1f.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, HTML_MESSAGE=0.001,
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-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
--000000000000592715065b4034e0
Content-Type: text/plain; charset="UTF-8"
In recent master, `(kill-all-local-variables 'reset)` doesn't remove any
buffer-local bindings. Plain and `t` arguments still do.
This showed up for me because I use doom-modeline and any command during
which the mode line is evaluated and a `:eval` form calls
`string-pixel-width` deactivates the region. With doom-modeline, the first
`C-SPC C-n` in a fresh buffer doesn't get a region set.
This seems to be because `work-buffer--release` relies on `'reset` to flush
the reusable work buffer, and one variable in there is `deactivate-mark`,
which becomes buffer-local when set and is set by the `add-text-properties`
and `erase-buffer` calls in `work-buffer--prepare-pixelwise` and
`work-buffer--release` (only the `insert` is inside a `let`).
Recipe (emacs -Q in batch)
-----------------
emacs -Q --batch --eval '(progn (transient-mark-mode 1) (defun bug ()
(interactive) (set-mark (point)) (string-pixel-width "x")) (global-set-key
(kbd "C-c b") (function bug)) (with-current-buffer (generate-new-buffer
"t") (insert "abc") (execute-kbd-macro (kbd "C-c b")) (message
"mark-active: %S" mark-active)))'
Expected: mark-active: t
Observed: mark-active: nil
Removing the `string-pixel-width' call gives t. Replacing it with
`(with-work-buffer (insert "x"))', or with `(with-current-buffer
(get-buffer-create " *k*") (insert "a") (kill-all-local-variables
'reset))', gives nil again; with `(kill-all-local-variables)' or
`(kill-all-local-variables t)' in that form it gives t.
Recipe, interactive (GUI or -nw)
--------------------------------
1. emacs -Q
2. M-: (global-set-key (kbd "C-c b") (lambda () (interactive) (set-mark
(point)) (forward-char 3) (string-pixel-width "x"))) RET
3. C-x C-f /tmp/anything.txt RET (an existing file with some text; do not
type in the buffer)
4. C-c b
Expected: a three-character region is active and highlighted.
Observed: no region, `mark-active' is nil.
Note: the problem is masked in any buffer where `deactivate-mark' has
a buffer-local binding, i.e. any buffer that has been edited since its
last major-mode change.
Suggested fixes
---------------
- Make `(kill-all-local-variables 'reset)` and `'permanent-local'
actually remove the local bindings, as documented.
- Separately, `with-work-buffer' could bind `deactivate-mark' for
the whole body plus release, instead of only around `insert', so
that measuring a string never has this side effect regardless of how
the work buffer is flushed:
(with-current-buffer ,work-buffer
(let (deactivate-mark)
(unwind-protect
(progn ,@body)
(work-buffer--release ,work-buffer))))
Environment
-----------
In GNU Emacs 32.0.50 (build 1, aarch64-apple-darwin25.5.0, NS
appkit-2685.60 Version 26.5.2 (Build 25F84)) of 2026-08-15
Repository revision: 73add0e2bfb63ceb39e5166c9d3eb2fee7ad0ef3
Repository branch: master
System: macOS 26.5.2 (Darwin 25.5.0), aarch64
Features: ACL DBUS GLIB GNUTLS LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY
KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS ZLIB
--
Gary Oberbrunner
--000000000000592715065b4034e0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>In recent master, `(kill-all-local-variables 'res=
et)` doesn't remove any buffer-local bindings. Plain and `t` arguments =
still do.</div><div><br></div><div>This showed up for me because I use doom=
-modeline and any command during which the mode line is evaluated and a `:e=
val` form calls `string-pixel-width` deactivates the region.=C2=A0 With doo=
m-modeline, the first `C-SPC C-n` in a fresh buffer doesn't get a regio=
n set.<br><br>This seems=C2=A0to be because `work-buffer--release` relies o=
n `'reset` to flush the reusable work buffer, and one variable in there=
is=C2=A0`deactivate-mark`, which becomes buffer-local when set and is set =
by the `add-text-properties` and `erase-buffer` calls in `work-buffer--prep=
are-pixelwise` and `work-buffer--release` (only the `insert` is inside a `l=
et`).<br><br>Recipe (emacs -Q in batch)<br>-----------------<br>emacs -Q --=
batch --eval '(progn (transient-mark-mode 1) (defun bug () (interactive=
) (set-mark (point)) (string-pixel-width "x")) (global-set-key (k=
bd "C-c b") (function bug)) (with-current-buffer (generate-new-bu=
ffer "t") (insert "abc") (execute-kbd-macro (kbd "=
C-c b")) (message "mark-active: %S" mark-active)))'<br><=
br>Expected: mark-active: t<br>Observed: mark-active: nil</div><div><br>Rem=
oving the `string-pixel-width' call gives t.=C2=A0 Replacing it with `(=
with-work-buffer (insert "x"))', or with `(with-current-buffe=
r (get-buffer-create " *k*") (insert "a") (kill-all-loc=
al-variables 'reset))', gives nil again; with `(kill-all-local-vari=
ables)' or `(kill-all-local-variables t)' in that form it gives t.<=
br><br>Recipe, interactive (GUI or -nw)<br>--------------------------------=
<br><br>1. emacs -Q<br>2. M-: (global-set-key (kbd "C-c b") (lamb=
da () (interactive) (set-mark (point)) (forward-char 3) (string-pixel-width=
"x"))) RET<br>3. C-x C-f /tmp/anything.txt RET =C2=A0(an existin=
g file with some text; do not type in the buffer)<br>4. C-c b<br>Expected: =
a three-character region is active and highlighted.<br>Observed: no region,=
`mark-active' is nil.</div><div><br></div><div>Note: the problem is ma=
sked in any buffer where `deactivate-mark' has<br>a buffer-local bindin=
g, i.e. any buffer that has been edited since its<br>last major-mode change=
.</div><div><br>Suggested fixes<br>---------------<br><br>- Make `(kill-all=
-local-variables 'reset)` and `'permanent-local'<br>=C2=A0 actu=
ally remove the local bindings, as documented.=C2=A0</div><div><br>- Separa=
tely, `with-work-buffer' could bind `deactivate-mark' for<br>=C2=A0=
the whole body plus release, instead of only around `insert', so<br>=
=C2=A0 that measuring a string never has this side effect regardless of how=
<br>=C2=A0 the work buffer is flushed:<br><br>=C2=A0 =C2=A0 =C2=A0 (with-cu=
rrent-buffer ,work-buffer<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let (deactivate-m=
ark)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unwind-protect<br>=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (progn ,@body)<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 (work-buffer--release ,work-buffer))))<br><br>Environm=
ent<br>-----------<br><br>In GNU Emacs 32.0.50 (build 1, aarch64-apple-darw=
in25.5.0, NS<br>appkit-2685.60 Version 26.5.2 (Build 25F84)) of 2026-08-15<=
br>Repository revision: 73add0e2bfb63ceb39e5166c9d3eb2fee7ad0ef3<br>Reposit=
ory branch: master<br>System: macOS 26.5.2 (Darwin 25.5.0), aarch64<br>Feat=
ures: ACL DBUS GLIB GNUTLS LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY<br>KQUE=
UE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS<br>TREE_SITTER W=
EBP XIM XWIDGETS ZLIB</div><div><br></div><span class=3D"gmail_signature_pr=
efix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature" data-smartma=
il=3D"gmail_signature"><div dir=3D"ltr"><div>Gary Oberbrunner</div></div></=
div></div>
--000000000000592715065b4034e0--
Gary Oberbrunner <garyo@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#81849; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.