Improve documentation for merge-mode parameter in tp--handle-tp-text-property
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
This commit is contained in:
parent
148b255456
commit
9d97430d62
21
tp.el
21
tp.el
@ -1146,11 +1146,9 @@ If tp-text is nil, initialize it to the current text in the region.
|
|||||||
If tp-text is a string different from current text, replace the text.
|
If tp-text is a string different from current text, replace the text.
|
||||||
When PRESERVE-PROPS is non-nil, existing text properties are preserved
|
When PRESERVE-PROPS is non-nil, existing text properties are preserved
|
||||||
on the replaced text (used by tp-set and tp-add).
|
on the replaced text (used by tp-set and tp-add).
|
||||||
MERGE-MODE controls how embedded text properties in tp-text are handled:
|
MERGE-MODE is retained for backward compatibility but no longer affects behavior.
|
||||||
All modes now preserve embedded text properties from tp-text.
|
All modes now preserve embedded text properties from tp-text, with props taking
|
||||||
:merge - embedded properties are merged with props, with face merging (tp-add)
|
precedence over embedded props when there's a conflict.
|
||||||
:override or nil - props take precedence over embedded properties (tp-set)
|
|
||||||
:reset - props take precedence over embedded properties (tp-reset)
|
|
||||||
Returns (PROPS NEW-END NEW-OBJECT) where PROPS is the updated props,
|
Returns (PROPS NEW-END NEW-OBJECT) where PROPS is the updated props,
|
||||||
NEW-END is the new end position after any text replacement, and
|
NEW-END is the new end position after any text replacement, and
|
||||||
NEW-OBJECT is the new string object (only different for strings with tp-text)."
|
NEW-OBJECT is the new string object (only different for strings with tp-text)."
|
||||||
@ -1197,13 +1195,12 @@ NEW-OBJECT is the new string object (only different for strings with tp-text)."
|
|||||||
(message "tp: transform error for %s: %s" layer-name err)
|
(message "tp: transform error for %s: %s" layer-name err)
|
||||||
tp-text-val))
|
tp-text-val))
|
||||||
tp-text-val))
|
tp-text-val))
|
||||||
;; Handle embedded text properties based on merge-mode:
|
;; Embedded text properties from tp-text are now preserved in all cases.
|
||||||
;; All modes now preserve embedded text properties from tp-text.
|
;; The props passed to this function take precedence over embedded props
|
||||||
;; :merge - merge embedded props with props, with face merging (tp-add)
|
;; when there's a conflict (e.g., both have 'face' property).
|
||||||
;; :override/nil - props take precedence over embedded props (tp-set)
|
;; The merge-mode parameter is retained for backward compatibility but
|
||||||
;; :reset - props take precedence over embedded props (tp-reset)
|
;; no longer affects behavior in this function - all modes use the same
|
||||||
;; In all cases, use tp--merge-string-props-into-plist which handles
|
;; merging strategy via tp--merge-string-props-into-plist.
|
||||||
;; props taking precedence and special face merging when needed.
|
|
||||||
(result-props
|
(result-props
|
||||||
(tp--merge-string-props-into-plist final-text props)))
|
(tp--merge-string-props-into-plist final-text props)))
|
||||||
(if (stringp object)
|
(if (stringp object)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user