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.
This commit is contained in:
Lars Ingebrigtsen 2021-11-24 20:10:14 +01:00
parent 833a42fbcf
commit e99bf27158
2 changed files with 6 additions and 12 deletions

View file

@ -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

View file

@ -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.