unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: monnier@iro.umontreal.ca
Cc: me@eshelyaron.com, 74091@debbugs.gnu.org
Subject: bug#74091: 31.0.50; string-pixel-width in mode line disables region
Date: Sun, 10 Nov 2024 12:42:59 +0200	[thread overview]
Message-ID: <86frnzl68c.fsf@gnu.org> (raw)
In-Reply-To: <86jzdblgza.fsf@gnu.org> (message from Eli Zaretskii on Sun, 10 Nov 2024 08:50:49 +0200)

> Cc: me@eshelyaron.com, 74091@debbugs.gnu.org
> Date: Sun, 10 Nov 2024 08:50:49 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > Cc: me@eshelyaron.com, 74091@debbugs.gnu.org
> > Date: Sun, 10 Nov 2024 07:50:47 +0200
> > From: Eli Zaretskii <eliz@gnu.org>
> > 
> > > > @@ -1170,7 +1171,7 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too)
> > > >  	      swap_in_global_binding (XSYMBOL (sym));
> > > >  	    }
> > > >  
> > > > -          if (!NILP (prop))
> > > > +          if (!NILP (prop) && permanent_too)
> > > >              {
> > > >                /* If permanent-local, keep it.  */
> > > >                last = tmp;
> > > 
> > > This should be an || rather than an &&, no?
> > 
> > No, I don't think so.  If the permanent-local property is nil, we
> > should not take this branch, even if permanent_too is non-zero.  Or
> > what am I missing?
> 
> Hmm... but something is still amiss, because Emacs built with my patch
> comes up without fontifications, although font-lock-mode is t.  Any
> ideas?

Sorry, here's the correct patch:

diff --git a/src/buffer.c b/src/buffer.c
index 744b0ef..995984e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -113,7 +113,7 @@ #define OVERLAY_COUNT_MAX						\
 static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
                                     bool after, Lisp_Object arg1,
                                     Lisp_Object arg2, Lisp_Object arg3);
-static void reset_buffer_local_variables (struct buffer *, bool);
+static void reset_buffer_local_variables (struct buffer *, int);
 
 /* Alist of all buffer names vs the buffers.  This used to be
    a Lisp-visible variable, but is no longer, to prevent lossage
@@ -1112,10 +1112,11 @@ reset_buffer (register struct buffer *b)
    Instead, use Fkill_all_local_variables.
 
    If PERMANENT_TOO, reset permanent buffer-local variables.
-   If not, preserve those.  */
+   If not, preserve those.  PERMANENT_TOO = 2 means ignore
+   the permanent-local property of non-builtin variables.  */
 
 static void
-reset_buffer_local_variables (struct buffer *b, bool permanent_too)
+reset_buffer_local_variables (struct buffer *b, int permanent_too)
 {
   int offset, i;
 
@@ -1141,7 +1142,7 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too)
   bset_invisibility_spec (b, Qt);
 
   /* Reset all (or most) per-buffer variables to their defaults.  */
-  if (permanent_too)
+  if (permanent_too == 1)
     bset_local_var_alist (b, Qnil);
   else
     {
@@ -1170,7 +1171,7 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too)
 	      swap_in_global_binding (XSYMBOL (sym));
 	    }
 
-          if (!NILP (prop))
+          if (!NILP (prop) && !permanent_too)
             {
               /* If permanent-local, keep it.  */
               last = tmp;
@@ -3001,7 +3002,7 @@ DEFUN ("kill-all-local-variables", Fkill_all_local_variables,
 
   /* Actually eliminate all local bindings of this buffer.  */
 
-  reset_buffer_local_variables (current_buffer, !NILP (kill_permanent));
+  reset_buffer_local_variables (current_buffer, !NILP (kill_permanent) ? 2 : 0);
 
   /* Force mode-line redisplay.  Useful here because all major mode
      commands call this function.  */





  reply	other threads:[~2024-11-10 10:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 17:27 bug#74091: 31.0.50; string-pixel-width in mode line disables region Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-30 14:59 ` Eli Zaretskii
2024-10-30 15:26   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-30 16:01     ` Eli Zaretskii
2024-10-31 11:09       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 11:41         ` Eli Zaretskii
2024-10-31 12:24           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 14:35             ` Eli Zaretskii
2024-11-06  8:01               ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-06 12:49                 ` Eli Zaretskii
2024-11-06 14:12                   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-09 11:13                     ` Eli Zaretskii
2024-11-09 16:26           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-09 16:37             ` Eli Zaretskii
2024-11-09 18:06               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-09 18:14                 ` Eli Zaretskii
2024-11-09 18:35                   ` Eli Zaretskii
2024-11-09 22:11                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-10  5:50                       ` Eli Zaretskii
2024-11-10  6:50                         ` Eli Zaretskii
2024-11-10 10:42                           ` Eli Zaretskii [this message]
2024-11-10 16:46                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-10 19:17                               ` Eli Zaretskii
2024-11-10 20:19                                 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-11  3:22                                   ` Eli Zaretskii
2024-11-11  6:52                                     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86frnzl68c.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=74091@debbugs.gnu.org \
    --cc=me@eshelyaron.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).