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

Buffer contents -

(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?


When font-lock-mode is in use, you can use the font-lock-face property instead of face.

(add-text-properties 1 8 '(font-lock-face (:foreground "red")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.