GNU bug report logs - #76445
31.0.50; `eww' makes display property sticky

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Thu, 20 Feb 2025 19:02:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 76445 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 76445 <at> debbugs.gnu.org, manuel <at> ledu-giraud.fr
Subject: Re: bug#76445: 31.0.50; `eww' makes display property sticky
Date: Sat, 22 Feb 2025 12:43:08 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Manuel Giraud <manuel <at> ledu-giraud.fr>,  76445 <at> debbugs.gnu.org
> Date: Fri, 21 Feb 2025 08:51:41 -0500
> 
> > Could you see if making this part in eww-mode:
> >
> >   (setq text-property-default-nonsticky '((face . t) (eww-form . t)
> >                                           (field . t))))
> >
> > set only the buffer-local value of text-property-default-nonsticky
> > solves the problem without any regressions in eww-mode itself?
> >
> > Stefan, does it make sense to have this variable _not_ be buffer-local
> > when set?
> 
> I don't think I have more expertise than others in this area, but yes it
> would make sense for this var to be auto-buffer-local.  It's dangerous
> to change its global value, so it makes sense to do it only in response
> to `setq-default`.

Agreed.  So the changes below should fix this problem without any
changes in eww.el.  Manuel, could you please verify that?  It seems to
work here.

diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index bada8bd..90aa45e 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -4135,10 +4135,10 @@ Sticky Properties
 list.
 
 @defvar text-property-default-nonsticky
-This variable holds an alist which defines the default rear-stickiness
-of various text properties.  Each element has the form
-@code{(@var{property} . @var{nonstickiness})}, and it defines the
-stickiness of a particular text property, @var{property}.
+This buffer-local variable holds an alist which defines the default
+rear-stickiness of various text properties in the buffer.  Each element
+has the form @code{(@var{property} . @var{nonstickiness})}, and it
+defines the stickiness of a particular text property, @var{property}.
 
 If @var{nonstickiness} is non-@code{nil}, this means that the property
 @var{property} is rear-nonsticky by default.  Since all properties are
diff --git a/etc/NEWS b/etc/NEWS
index 110e955..080675e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1293,6 +1293,11 @@ An old alternative name (without the first 'e') has been removed.
 +++
 ** 'read-directory-name' now accepts an optional PREDICATE argument.
 
++++
+** 'text-property-default-nonsticky' is now buffer-local.
+This variable now becomes buffer-local when set.  Use 'setq-default' in
+(the unlikely) case you want to change the global value.
+
 ---
 ** All the digit characters now have the 'digit' category.
 All the characters whose Unicode general-category is Nd now have the
diff --git a/etc/symbol-releases.eld b/etc/symbol-releases.eld
index 645ab77..4120058 100644
--- a/etc/symbol-releases.eld
+++ b/etc/symbol-releases.eld
@@ -44,6 +44,7 @@
  ("22.1" fun version<)
  ("22.1" fun version<=)
  ("22.1" fun read-number)
+ ("21.1" var text-property-default-nonsticky)
 
 ;; Since much of early Emacs source history is lost, these versions are
 ;; conservative estimates: the actual version of first appearance may very
diff --git a/src/textprop.c b/src/textprop.c
index 30c26ce..8fdaafc 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -2427,6 +2427,7 @@ syms_of_textprop (void)
      by default.  */
   Vtext_property_default_nonsticky
     = list2 (Fcons (Qsyntax_table, Qt), Fcons (Qdisplay, Qt));
+  Fmake_variable_buffer_local (Qtext_property_default_nonsticky);
 
   interval_insert_behind_hooks = Qnil;
   interval_insert_in_front_hooks = Qnil;
@@ -2444,6 +2445,7 @@ syms_of_textprop (void)
   DEFSYM (Qlocal_map, "local-map");
   DEFSYM (Qfront_sticky, "front-sticky");
   DEFSYM (Qrear_nonsticky, "rear-nonsticky");
+  DEFSYM (Qtext_property_default_nonsticky, "text-property-default-nonsticky");
   DEFSYM (Qmouse_face, "mouse-face");
   DEFSYM (Qminibuffer_prompt, "minibuffer-prompt");
 




This bug report was last modified 86 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.