Changing faces one at a time, outside customize
up vote
3
down vote
favorite
Is there a way to change faces one at a time, outside of customize?
In my custom-file
I see a big blob of face customizations that starts with:
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
...
So I suppose custom-set-faces
is not the right function to use for changing just one face, but I'm not sure what is.
Any suggestions?
faces
add a comment |
up vote
3
down vote
favorite
Is there a way to change faces one at a time, outside of customize?
In my custom-file
I see a big blob of face customizations that starts with:
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
...
So I suppose custom-set-faces
is not the right function to use for changing just one face, but I'm not sure what is.
Any suggestions?
faces
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Is there a way to change faces one at a time, outside of customize?
In my custom-file
I see a big blob of face customizations that starts with:
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
...
So I suppose custom-set-faces
is not the right function to use for changing just one face, but I'm not sure what is.
Any suggestions?
faces
Is there a way to change faces one at a time, outside of customize?
In my custom-file
I see a big blob of face customizations that starts with:
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
...
So I suppose custom-set-faces
is not the right function to use for changing just one face, but I'm not sure what is.
Any suggestions?
faces
faces
asked Nov 10 at 14:27
izkon
566113
566113
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
You can use custom-set-faces
or custom-theme-set-faces
, with a list of one face - no problem. Or you can use modify-face
. Or, as @erikstokes mentions, you can use set-face-attribute
.
Note that the Elisp manual, node Attribute Functions, says this about set-face-attribute
(but it doesn't say why):
This function is mostly intended for internal usage.
Note too that in the case of user options (variables), there are the single-option functions customize-set-variable
and customize-set-value
, which are companions to the multiple-option function custom-set-variables
that is written to your custom-file
(or init file). They are also commands, letting you choose the option using completion.
But for faces there is no such single-face companion function (and no command, other than customize-face
).
For some reasoncustom-set-options
does not appear in mycustom-file
(nor inC-h f custom-set-options
). Instead, it usescustom-set-variables
.
– izkon
Nov 10 at 18:25
Sorry, I meantcustom-set-variables
- I updated the answer to correct that.
– Drew
Nov 10 at 18:38
add a comment |
up vote
1
down vote
set-face-attribute
is the function you want. For example to make comments green and bold:
(set-face-attribute 'font-lock-comment-face nil
:foreground "Green"
:weight 'bold)
There are also helper functions set-face-foreground
and set-face-background
for the common case of just changing the color of the face.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
You can use custom-set-faces
or custom-theme-set-faces
, with a list of one face - no problem. Or you can use modify-face
. Or, as @erikstokes mentions, you can use set-face-attribute
.
Note that the Elisp manual, node Attribute Functions, says this about set-face-attribute
(but it doesn't say why):
This function is mostly intended for internal usage.
Note too that in the case of user options (variables), there are the single-option functions customize-set-variable
and customize-set-value
, which are companions to the multiple-option function custom-set-variables
that is written to your custom-file
(or init file). They are also commands, letting you choose the option using completion.
But for faces there is no such single-face companion function (and no command, other than customize-face
).
For some reasoncustom-set-options
does not appear in mycustom-file
(nor inC-h f custom-set-options
). Instead, it usescustom-set-variables
.
– izkon
Nov 10 at 18:25
Sorry, I meantcustom-set-variables
- I updated the answer to correct that.
– Drew
Nov 10 at 18:38
add a comment |
up vote
4
down vote
accepted
You can use custom-set-faces
or custom-theme-set-faces
, with a list of one face - no problem. Or you can use modify-face
. Or, as @erikstokes mentions, you can use set-face-attribute
.
Note that the Elisp manual, node Attribute Functions, says this about set-face-attribute
(but it doesn't say why):
This function is mostly intended for internal usage.
Note too that in the case of user options (variables), there are the single-option functions customize-set-variable
and customize-set-value
, which are companions to the multiple-option function custom-set-variables
that is written to your custom-file
(or init file). They are also commands, letting you choose the option using completion.
But for faces there is no such single-face companion function (and no command, other than customize-face
).
For some reasoncustom-set-options
does not appear in mycustom-file
(nor inC-h f custom-set-options
). Instead, it usescustom-set-variables
.
– izkon
Nov 10 at 18:25
Sorry, I meantcustom-set-variables
- I updated the answer to correct that.
– Drew
Nov 10 at 18:38
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
You can use custom-set-faces
or custom-theme-set-faces
, with a list of one face - no problem. Or you can use modify-face
. Or, as @erikstokes mentions, you can use set-face-attribute
.
Note that the Elisp manual, node Attribute Functions, says this about set-face-attribute
(but it doesn't say why):
This function is mostly intended for internal usage.
Note too that in the case of user options (variables), there are the single-option functions customize-set-variable
and customize-set-value
, which are companions to the multiple-option function custom-set-variables
that is written to your custom-file
(or init file). They are also commands, letting you choose the option using completion.
But for faces there is no such single-face companion function (and no command, other than customize-face
).
You can use custom-set-faces
or custom-theme-set-faces
, with a list of one face - no problem. Or you can use modify-face
. Or, as @erikstokes mentions, you can use set-face-attribute
.
Note that the Elisp manual, node Attribute Functions, says this about set-face-attribute
(but it doesn't say why):
This function is mostly intended for internal usage.
Note too that in the case of user options (variables), there are the single-option functions customize-set-variable
and customize-set-value
, which are companions to the multiple-option function custom-set-variables
that is written to your custom-file
(or init file). They are also commands, letting you choose the option using completion.
But for faces there is no such single-face companion function (and no command, other than customize-face
).
edited Nov 10 at 18:38
answered Nov 10 at 17:32
Drew
46.3k461103
46.3k461103
For some reasoncustom-set-options
does not appear in mycustom-file
(nor inC-h f custom-set-options
). Instead, it usescustom-set-variables
.
– izkon
Nov 10 at 18:25
Sorry, I meantcustom-set-variables
- I updated the answer to correct that.
– Drew
Nov 10 at 18:38
add a comment |
For some reasoncustom-set-options
does not appear in mycustom-file
(nor inC-h f custom-set-options
). Instead, it usescustom-set-variables
.
– izkon
Nov 10 at 18:25
Sorry, I meantcustom-set-variables
- I updated the answer to correct that.
– Drew
Nov 10 at 18:38
For some reason
custom-set-options
does not appear in my custom-file
(nor in C-h f custom-set-options
). Instead, it uses custom-set-variables
.– izkon
Nov 10 at 18:25
For some reason
custom-set-options
does not appear in my custom-file
(nor in C-h f custom-set-options
). Instead, it uses custom-set-variables
.– izkon
Nov 10 at 18:25
Sorry, I meant
custom-set-variables
- I updated the answer to correct that.– Drew
Nov 10 at 18:38
Sorry, I meant
custom-set-variables
- I updated the answer to correct that.– Drew
Nov 10 at 18:38
add a comment |
up vote
1
down vote
set-face-attribute
is the function you want. For example to make comments green and bold:
(set-face-attribute 'font-lock-comment-face nil
:foreground "Green"
:weight 'bold)
There are also helper functions set-face-foreground
and set-face-background
for the common case of just changing the color of the face.
add a comment |
up vote
1
down vote
set-face-attribute
is the function you want. For example to make comments green and bold:
(set-face-attribute 'font-lock-comment-face nil
:foreground "Green"
:weight 'bold)
There are also helper functions set-face-foreground
and set-face-background
for the common case of just changing the color of the face.
add a comment |
up vote
1
down vote
up vote
1
down vote
set-face-attribute
is the function you want. For example to make comments green and bold:
(set-face-attribute 'font-lock-comment-face nil
:foreground "Green"
:weight 'bold)
There are also helper functions set-face-foreground
and set-face-background
for the common case of just changing the color of the face.
set-face-attribute
is the function you want. For example to make comments green and bold:
(set-face-attribute 'font-lock-comment-face nil
:foreground "Green"
:weight 'bold)
There are also helper functions set-face-foreground
and set-face-background
for the common case of just changing the color of the face.
answered Nov 10 at 14:53
erikstokes
8,96322142
8,96322142
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f45895%2fchanging-faces-one-at-a-time-outside-customize%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown