Subject: Re: bug#74091: 31.0.50; string-pixel-width in mode line disables region

From: Eshel Yaron <[email-masked]>
Date: Wed, 06 Nov 2024 09:01:16 +0100

Hi,

Eli Zaretskii <[email-masked]> writes:

>> > Look, you are welcome to keep debugging this if you are interested.  I
>> > invested enough of my time into figuring out why the region was
>> > deactivated by C-n, and the solution I installed satisfies me.  But
>> > you are welcome to keep digging, and let me tell you what I found to
>> > save you some non-trivial tinkering:
>> 
>> Thank you, I'll keep digging and let you know if I figure it out.
>
> TIA.

FYI after spending a bit more time on this issue, I concluded that
(kill-all-local-variables t) is inherently problematic: it breaks
assumptions that Emacs relies on.  (See bug#73005 for another example.)

It doesn't seem like killing permanent-local variables in the work
buffers is necessary ATM, so the fix I'm using is the following:

diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 5b47deb880e..b5cbe28afad 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -361,7 +361,7 @@ work-buffer--release
           (erase-buffer))
         (delete-all-overlays)
         (let (change-major-mode-hook)
-          (kill-all-local-variables t))
+          (kill-all-local-variables))
         ;; Make the buffer available again.
         (push buffer work-buffer--list)))
   ;; If the maximum number of reusable work buffers is exceeded, kill

Best,

Eshel