rougier / svg-lib

Emacs SVG libraries for creatings tags, icons and bars
GNU General Public License v3.0
335 stars 30 forks source link

Only activating when executing activating command in individual buffer #25

Open ChloeZhou1997 opened 1 year ago

ChloeZhou1997 commented 1 year ago

The demo works, but only if I execute

;; Activate
(push 'display font-lock-extra-managed-props)
(font-lock-add-keywords nil svg-font-lock-keywords)
(font-lock-flush (point-min) (point-max))

This part of the code in the buffer where I want the style to be turn on... if there any other way I can do it?

rougier commented 1 year ago

The first line tells Emacs font-lock should use the display properties with font lock and it is a global settings I think. For the second line, this actually adds the new keyword and the last line force a recomputation. Depending on where you svg-libs, you can ad this to a hook function for some specific modes.