Skip to main content
2 of 3
add font-lock tag
JeanPierre
  • 7.5k
  • 1
  • 21
  • 39

Add text property, when global-font-lock mode is on

I am trying to set the foreground color for first line in my buffer which has global-font-lock ON.

Buffer contents -

(ignore) 
(add-text-properties 1 8
                                         '(:foreground "red"))
;;since add-text-properties didn't work, i tried with add-face-text-property
(add-face-text-property 1 8 '(:foreground "red"))

When i do eval-buffer, i like to see the first line, (ignore) made red. But it is not so. I referred here to know the function, add-text-properties doesn't work when font-lock mode is ON.

Is there a way one can change the properties for text that lies between a start and end point?

Saravana
  • 2.1k
  • 13
  • 32