0

I have many color variables defined in my css - LESS file, whose background color i like to highlight on text selection and running this elisp block.

(add-text-properties
 (region-beginning)
 (region-end) 
 '(:background (buffer-substring (region-beginning) (region-end))))

When i chose the word, #ea7600 in this LESS code and eval the above elisp code,

@rw-orange:         **#ea7600**;
@rw-orange-dark:    #ce6006;
@rw-orange-light:   #fff5cc;

It didn't change the text's background to orange color. How can i make such a change and persist it too for all future sessions?

3
  • 1
    You need to specify that the text property you want to add is property face (or font-lock-face, depending on what you are trying to do). But why not just customize face region, using M-x customize-face RET region? – Drew Jul 23 '16 at 0:38
  • i like the new color to remain, even when the selection gets removed.... – Madhavan Jul 23 '16 at 1:28
  • I see. Now the question makes more sense. You still need to add face to your add-text-properties call, however. – Drew Jul 23 '16 at 2:17

Your Answer

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

Browse other questions tagged or ask your own question.