1

Windows 10, Emacs 25.1

By default package highlight-symbol has 9 colors. So I add new color, snow, to option highlight-symbol-colors:

Screenshot:

enter image description here

OK.

As a result Customize puts this in my init file:

(custom-set-variables

 '(highlight-symbol-colors
   (quote
    ("yellow" "DeepPink" "cyan" "MediumPurple1" "SpringGreen1" "DarkOrange" "HotPink1" "RoyalBlue1" "OliveDrab" "snow")))
 )

As you can see the variable highlight-symbol-colors contains all 10 colors, including "snow".

My question is:

How to make option highlight-symbol-colors contain ONLY the colors I add, and not also the colors that it has by default?

I want the result to be something like this:

(custom-set-variables
 '(highlight-symbol-colors
   (quote ("snow"))))

So as result I must use 10 colors.

Is this possible?

  • Please edit the title of your question, based on what you think you are really asking. The question is not clear as posed. I corrected the title based on what it seemed you were asking, which was how to use Customize to delete elements from a list value. Your comment to my answer suggests that that is not at all what you want to know. – Drew Sep 2 '17 at 17:15
  • IIUC what bothers you is the longish customize snippet. Then you could simply move this to another file. See the variable custom-file. – YoungFrog Sep 3 '17 at 7:19
1

Of course. In Customize, just click DEL for each of the colors that you do not want to include.

INS inserts a color value. DEL deletes a color value.


UPDATE after your comment:

Your comment suggests that you want to use a function in your init file that takes only "snow" as argument and adds it to the value of highlight-symbol-colors. If not, it is really not clear what you are asking.

If that's what you want, then do it:

(defun foo (&rest colors)
  "Add COLOR to the value of `highlight-symbol-colors`."
  (customize-set-variable 'highlight-symbol-colors
                          (append highlight-symbol-colors colors)))

Then put this in your init file: (foo "snow").

  • My mistake. Sorry. I want another behavior. I want to be all default colors value (9 colors). But in init.el to set only new (snow) color. Is it possible? So as result I must use 10 colors. – user8542613 Sep 2 '17 at 17:02
  • That's what I need. I want this because if some another variable has very long default list, I wan't to see ALL items of this list it in init.el. – user8542613 Sep 2 '17 at 17:52
  • If the answer is what you need then consider accepting it. – Drew Sep 2 '17 at 18:25

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.