Skip to content

Instantly share code, notes, and snippets.

@anton0xf
Last active July 15, 2021 07:04
Show Gist options
  • Save anton0xf/062ec656e66c88b5240dfb332ead82e1 to your computer and use it in GitHub Desktop.
Save anton0xf/062ec656e66c88b5240dfb332ead82e1 to your computer and use it in GitHub Desktop.
;; run it by command
;; $ emacs -Q --script test-add-face-text-property.el
(setq line "asdf qwer")
(add-face-text-property 0 4 'a t line)
(add-face-text-property 0 4 'a t line)
(print line)
;; #("asdf qwer" 0 4 (face a))
(add-face-text-property 0 5 'b t line)
(add-face-text-property 0 5 'b t line)
(add-face-text-property 0 5 'b t line)
(print line)
;; #("asdf qwer" 0 4 (face (a b b b)) 4 5 (face b))
(setq word (substring line 0 4))
(print word)
;; #("asdf" 0 4 (face (a b b b)))
(add-face-text-property 0 1 'c t word)
(add-face-text-property 0 2 'd t word)
(print word)
;; #("asdf" 0 1 (face (a b b b c d d)) 1 2 (face (a b b b c d d)) 2 4 (face (a b b b c d d)))
(print line)
;; #("asdf qwer" 0 4 (face (a b b b c d d)) 4 5 (face b))
@anton0xf
Copy link
Author

Example for cpitclaudel/company-coq#252
Tested on emacs 26.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment