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}.
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
;;;###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)
(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.