Saya memiliki string propertized. Saya ingin membuat salinan yang dalam untuk menambahkan lebih banyak properti, sambil mempertahankan properti dalam string asli. Bagaimana saya bisa melakukan itu (dengan mudah)?
Contoh
Evaluasi satu per satu:
(setq test-str-1
#(";; This `is' a test"
0 3 (fontified nil face font-lock-comment-delimiter-face)
3 9 (fontified nil face font-lock-comment-face)
9 11 (fontified nil face (font-lock-constant-face font-lock-comment-face))
11 19 (fontified nil face font-lock-comment-face)))
(setq test-str-2 (concat test-str-1))
(add-face-text-property 0 (length test-str-2) 'foobar t test-str-2)
Dan hasilnya:
test-str-2
;; =>
#(";; This `is' a test" 0 3 (fontified nil face (font-lock-comment-delimiter-face foobar))
3 9 (fontified nil face (font-lock-comment-face foobar))
9 11 (fontified nil face (font-lock-constant-face font-lock-comment-face foobar))
11 19 (fontified nil face (font-lock-comment-face foobar)))
test-str-1
;; =>
#(";; This `is' a test" 0 3 (face font-lock-comment-delimiter-face fontified nil)
3 9 (face font-lock-comment-face fontified nil)
9 11 (face (font-lock-constant-face font-lock-comment-face foobar) ; <= foobar is here
fontified nil)
11 19 (face font-lock-comment-face fontified nil))
add-face-text-property. Seharusnya tidak merusak daftar, karena gagal ketika daftar itu disebut oleh orang lain.