summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/subr-x.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-24 20:10:14 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-24 20:10:17 +0100
commite99bf271587399650a6d52beea4c8f1340d66689 (patch)
tree16f46a84fd7d0e62c1ffbb2fcc7fab8003dde9ed /lisp/emacs-lisp/subr-x.el
parent833a42fbcf78ec99b84a98dd6bc7c2eea6eeaef6 (diff)
downloademacs-e99bf271587399650a6d52beea4c8f1340d66689.tar.gz
emacs-e99bf271587399650a6d52beea4c8f1340d66689.tar.bz2
emacs-e99bf271587399650a6d52beea4c8f1340d66689.zip
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.
Diffstat (limited to 'lisp/emacs-lisp/subr-x.el')
-rw-r--r--lisp/emacs-lisp/subr-x.el13
1 files changed, 5 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 3ec880f8b8f..b53245b9b5f 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.