[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e99bf27 2/2: Remove APPEND argument from add-display-text-propert
From: |
Lars Ingebrigtsen |
Subject: |
master e99bf27 2/2: Remove APPEND argument from add-display-text-property |
Date: |
Wed, 24 Nov 2021 14:10:24 -0500 (EST) |
branch: master
commit e99bf271587399650a6d52beea4c8f1340d66689
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Remove APPEND argument from add-display-text-property
* doc/lispref/display.texi (Display Property): Update doc.
* lisp/emacs-lisp/subr-x.el (add-display-text-property): Remove
the append argument -- it's nonsensical.
---
doc/lispref/display.texi | 5 +----
lisp/emacs-lisp/subr-x.el | 13 +++++--------
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 7204581..6742f0e 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -4904,7 +4904,7 @@ with @code{get-char-property}, for instance
(@pxref{Examining
Properties}).
@end defun
-@defun add-display-text-property start end prop value &optional append object
+@defun add-display-text-property start end prop value &optional object
Add @code{display} property @var{prop} of @var{value} to the text from
@var{start} to @var{end}.
@@ -4922,9 +4922,6 @@ After doing this, the region from 2 to 4 will have the
@code{raise}
the region from 8 to 12 will only have the @code{raise} @code{display}
property.
-If @var{append} is non-@code{nil}, append to the list of display
-properties; otherwise prepend.
-
If @var{object} is non-@code{nil}, it should be a string or a buffer.
If @code{nil}, this defaults to the current buffer.
@end defun
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 3ec880f..b53245b 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -471,14 +471,11 @@ This takes into account combining characters and grapheme
clusters."
;;;###autoload
(defun add-display-text-property (start end prop value
- &optional append object)
+ &optional object)
"Add display property PROP with VALUE to the text from START to END.
If any text in the region has a non-nil `display' property, those
properties are retained.
-If APPEND is non-nil, append to the list of display properties;
-otherwise prepend.
-
If OBJECT is non-nil, it should be a string or a buffer. If nil,
this defaults to the current buffer."
(let ((sub-start start)
@@ -504,10 +501,10 @@ this defaults to the current buffer."
(list disp))
(t
disp)))
- (setq disp
- (if append
- (append disp (list (list prop value)))
- (append (list (list prop value)) disp)))
+ ;; Remove any old instances.
+ (when-let ((old (assoc prop disp)))
+ (setq disp (delete old disp)))
+ (setq disp (cons (list prop value) disp))
(when vector
(setq disp (seq-into disp 'vector)))
;; Finally update the range.