In this scenario, there exists one or more faces for a particular condition named "foo"
. When the condition changes to the name of "bar"
, the goal is to add an additional face attribute such as :strike-through t
. How can this be done without explicitly defining separate faces for both conditions? E.g., eliminate the need to define my-face+strike-through
.
(defface my-face
'((t (:foreground "red")))
"Doc-string"
:group 'my-faces)
(defface my-face+strike-through
'((t (:foreground "red" :strike-through t)))
"Doc-string"
:group 'my-faces)
(let ((txt "foo"))
(if (equal txt "bar")
(add-text-properties 0 (length txt) (list 'face 'my-face) txt)
(add-text-properties 0 (length txt) (list 'face 'my-face+strike-through) txt))
txt)