Questions tagged [emacs-faces]

A face in GNU Emacs is a text style.

A face can have various attributes, such as foreground and background colors, font, height, and weight. Faces are applied as text properties to characters in a string or buffer, or as overlay properties to buffer positions. Face attribute values can be inherited from one or more faces by another face.

95 questions
8
votes
2 answers

How do I change Emacs's font face for Python docstrings?

I'm just starting to learn Python and use Emacs as my editor. Currently, Emacs uses the same color for normal strings (single quotes) and docstrings (triple quotes). I want docstrings to be a different color, so I used the 'Options->Customize…
Jesse DeGuire
  • 359
  • 3
  • 7
8
votes
2 answers

Customizing highlighting faces in Emacs: Only change the background color

Is there any way to define a face in Emacs (e.g. highlight such as hl-line) so that it only changes the background color (and have Emacs use the foreground color as if the word was not highlighted). More specifically, I tried the following on the…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
7
votes
1 answer

Is there a way to prevent font-locking from changing the font family (and change color only)?

Admittedly, this is something of a first world problem, but I'm sort of picky about the appearance of the display, and I find it really annoying when some mode sets a new font size, family, bold/italic, etc. What I'd like to do is put…
deong
  • 3,820
  • 21
  • 18
6
votes
1 answer

Is there a way to copy text from emacs with faces in Windows?

Every now and then I run into a situation when I need to email a piece of code from emacs. When I paste text into my email program (not emacs), all the color highlighting is lost. This is especially disappointing when pasting from org-mode, which…
user443854
  • 7,096
  • 13
  • 48
  • 63
6
votes
4 answers

Change Emacs' background color

I have a function that sets Emacs' color theme to a theme defined by myself. In this function I do: (set-face-attribute 'default cur-frame :foreground fg-color :background bg-color) I then set the background color, foreground color, and cursor…
sudo
  • 647
  • 2
  • 7
  • 19
6
votes
2 answers

Change Emacs Mode-Line color based on major-mode

I like to see if there is a way to change the mode-link foreground and background color base on the major-mode, I was thinking to add the logic in the (add-hook 'after-change-major-mode-hook But, I do not have all the emacs lisp experience to make…
TX T
  • 817
  • 2
  • 16
  • 25
5
votes
2 answers

How can I change the face of scalar variables in emacs cperl-mode?

In cperl-mode I am able to change the array and hash faces with M-x customize-group RET cperl-faces RET, and change Cperl Hash Face and Cperl Hash Face. But I can not see any option for changing the scalar variables color. I have tried to change…
Pablo Marin-Garcia
  • 4,151
  • 2
  • 32
  • 50
4
votes
3 answers

emacs: how to change the foreground color of highlights (e.g., links the point is over)?

I have a color theme file (similar to gruber-darker.el) and I would like to adjust a specific color. This color can be described as follows: Change to Org Agenda (the org-mode agenda buffer) via M-x org-agenda a. Then move the cursor over a…
Marius Hofert
  • 6,546
  • 10
  • 48
  • 102
4
votes
1 answer

change color of code within #if 0 ... #endif block in C/C++ mode in Emacs 21.3.1

With reference to the link, In C/C++ mode in Emacs, change face of code in #if 0...#endif block to comment face. I tried the code but it doesnot seem to be working. My emacs version is GNU Emacs 21.3.1 on Linux. Please can you let me know where I am…
asd
  • 41
  • 2
4
votes
3 answers

What are some good emacs font faces to manually set?

There is alllll kinds of information out there about emacs color schemes, font locks, etc but I am having trouble getting where I want to be. Basically I would like to know what are some of the best font faces to set in order to have a nice solid…
re5et
  • 4,305
  • 3
  • 25
  • 26
4
votes
1 answer

Where do I input a piece of code in Emacs?

I have just started using Emacs for the specific purpose of editing latex documents. I was attracted to Emacs because I want to be able to customize syntax highlighting even to the point of defining the colors of specific words. I am new to Emacs…
Vivi
  • 4,070
  • 6
  • 29
  • 44
4
votes
1 answer

distinct face for search/replacement strings in emacs minibuffer

When I use query-replace to replace, say, "abc" by "def", and then call query-replace again, I get a minibuffer that looks like this, all in the same face: Query replace (default abc -> def): It would be easier to read this line if "abc" and…
Alan
  • 1,889
  • 2
  • 18
  • 30
4
votes
1 answer

How to nest various `propertize`s?

I want to do the elisp equivalent of normalbold I've tried (propertize (concat "normal" (propertize "bold" 'font-lock-face '(:weight bold))) 'font-lock-face…
konr
  • 2,545
  • 2
  • 20
  • 38
4
votes
2 answers

Emacs syntax highlighting of optional parts

I'm trying to write a derived mode from fundamental-mode. Assuming that I have this regexp : A ((foo)bar)? B, how can I tell emacs to use the following faces ? font-lock-keyword-face on A font-lock-warning-face on foo (but not…
Maël Nison
  • 7,055
  • 7
  • 46
  • 77
3
votes
1 answer

How do I find documentation for this Emacs command?

This question shows how to change a particular Emacs setting with set-face-attribute. Where can I find documentation on set-face-attribute? Normally I find documentation by C-h a, followed by a command or fragment of a command. But doing this for…
user11583
  • 431
  • 3
  • 11