]> git.eshelyaron.com Git - emacs.git/commit
Don't delete in-place when replacing a display property
authorJim Porter <jporterbugs@gmail.com>
Wed, 28 May 2025 16:55:58 +0000 (09:55 -0700)
committerEshel Yaron <me@eshelyaron.com>
Wed, 18 Jun 2025 08:04:18 +0000 (10:04 +0200)
commitd1953a07330c46a18925e2d2fb901741b0641298
tree7a4e0a9b5d7dd9dbd9ef3740155e4d49476a939a
parentca63e9aab18d7e0df1666744cf9d49fb639ec13f
Don't delete in-place when replacing a display property

When calling 'add-display-text-property' on a region of text that
already contains PROP, we first delete the old display specification
from the region.  If the region's 'display' property is a list of
display specifications, we need to avoid destructively modifying the
list; other regions of text could be using the same list object.  (For a
'display' property that's a vector or a single display spec, this
doesn't matter since we first make a new list in the code.)

In addition, be more careful when working with a display property like
((margin ...) ...).  This is a single display specification, not a list
of display specs.

* lisp/emacs-lisp/subr-x.el (add-display-text-property): Don't delete
in-place for list values.  Handle (margin ...) display specification
type correctly.

* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x-test-add-display-text-property): Update test.

(cherry picked from commit 4a3c8e6e1df44b187b7286747e363232e8b4e0ea)
lisp/emacs-lisp/subr-x.el
test/lisp/emacs-lisp/subr-x-tests.el