"Append to a text property from START to END.
PROP is the text property to append to, and VALUE is the list of
property values to append. OBJECT is the object to propertize, as with
-`put-text-property' (which see)."
- (let (next)
+`put-text-property' (which see).
+
+If PROP's value is not a list at any position between START and END,
+this function leaves its value at those positions unchanged."
+ (let (next old-value)
(while (< start end)
- (setq next (next-single-property-change start prop object end))
- (put-text-property start next prop
- (append (get-text-property start prop object) value)
- object)
+ (setq next (next-single-property-change start prop object end)
+ old-value (get-text-property start prop object))
+ (when (listp old-value)
+ (put-text-property start next prop (append old-value value) object))
(setq start next))))
(defun eshell-emit-prompt ()
"Check that stickiness properties are properly merged on Eshell prompts."
(let ((eshell-prompt-function
(lambda ()
- (concat (propertize (eshell/pwd) 'front-sticky '(front))
- (propertize "$ " 'rear-nonsticky '(rear))))))
+ (concat (propertize (eshell/pwd)
+ 'front-sticky '(front) 'rear-nonsticky t)
+ (propertize "$ "
+ 'front-sticky t 'rear-nonsticky '(rear))))))
(with-temp-eshell
(eshell-insert-command "echo hello")
(let ((last-prompt (field-string (1- eshell-last-input-start))))
'field 'prompt
'font-lock-face 'eshell-prompt
'front-sticky '(front read-only font-lock-face field)
- 'rear-nonsticky '(read-only font-lock-face field))
+ 'rear-nonsticky t)
(propertize
"$ "
'read-only t
'field 'prompt
'font-lock-face 'eshell-prompt
- 'front-sticky '(read-only font-lock-face field)
+ 'front-sticky t
'rear-nonsticky '(rear read-only font-lock-face field)))))))))
(ert-deftest em-prompt-test/after-failure ()