Hot answers tagged

21 votes
Accepted

How do I insert text with a specific face?

There are some problem with the code: put-text-property is applied to an object. In this case your string. You need to pass it as as the last parameter. put-text-property starts counting at zero. If ...
user avatar
  • 5,765
18 votes

How can I set different font sizes for buffers and for the mode-line?

Try replacing the code for setting the font size with this: (set-face-attribute 'default nil :font "DejaVu Sans Mono-14") (set-face-attribute 'mode-line nil :font "DejaVu Sans Mono-10") Of course, ...
user avatar
  • 14.2k
18 votes

Emacs Blue color too dark

Put the cursor on the blue word, and say C-u C-x =. Find the face entry and click on its value. Then click on customize this face and change the foreground value to e.g. Cyan1. If you are in a ...
user avatar
  • 19.9k
16 votes
Accepted

Emacs Blue color too dark

Add (setq frame-background-mode 'dark) to ~/.emacs.d/init.el
user avatar
  • 675
15 votes
Accepted

How to modify-face for a specific buffer?

As noted by @phils in the comment below, the Emacs manual suggests not modifying the face-remapping-alist directly due to possible unintended side effects: . . .to avoid trampling on remappings ...
user avatar
  • 17.7k
15 votes

Disable enlarged org-mode header appearance

Okay I found a solution that worked for me. (defun my/org-mode-hook () "Stop the org-level headers from increasing in height relative to the other text." (dolist (face '(org-level-1 ...
user avatar
14 votes
Accepted

How can I set face for echo-area message

No they don't get printed as text. :-) Evaluate the following function, then call M-x mes. Doesn't it work? (defun mes () "message me" (interactive) (message (propertize "text" 'face 'font-...
user avatar
  • 22.4k
14 votes

Colors for different priorities in Org mode

You can customize org-priority-faces to give specific attributes for each priority. From C-h v org-priority-faces, Documentation: Faces for specific Priorities. This is a list of cons cells, ...
user avatar
  • 5,005
14 votes

Is there a way to change color of active window's fringe?

Since you want "To better distinguish between focused window", you can use other ways to do that instead of just changing the active window's fringe color. I combine three ways to better distinguish ...
user avatar
  • 2,559
12 votes
Accepted

How to make the region face take priority over the `show-paren-mode` face?

Customize option show-paren-priority to have a negative value, e.g., -50. No, this is not documented anywhere. Yes, a bug was filed about that. No, the bug report was never responded to. See Emacs ...
user avatar
  • 69.7k
11 votes
Accepted

describe-face character not under / unreachable by the cursor

I do not know about using the mouse, but I've often found it's easiest for me to run list-faces-display and then just i-search for what the face is likely called or visually scan for text that looks ...
user avatar
11 votes

Quickly Adjusting Text to DPI Changes

You can set the value of default-frame-alist, including its font parameter, conditionally, depending on the current monitor/display. (You can use function display-monitor-attributes-list to give you ...
user avatar
  • 69.7k
10 votes

describe-face character not under / unreachable by the cursor

There are 4 regions where text may be displayed in Emacs, here is what you can do to inspect each of them. The mode-line: See the value of mode-line-format. The header-line: See the value of header-...
user avatar
  • 22.4k
10 votes

how to prevent faces from bleeding onto surrounding areas of buffer?

This looks like a bug triggered by org-mode's org-activate-bracket-links function. This is what this function looks like: (defun org-activate-bracket-links (limit) "Run through the buffer and add ...
user avatar
  • 5,216
10 votes
Accepted

How can I override a pre-defined face for light and dark backgrounds?

Thanks to @MadhavanKumar, I focused on deriving a solution based on defface. I realized that I can't override an existing defface but I can always create my own background color sensitive defface. ...
user avatar
  • 24.3k
10 votes
Accepted

How to Strike out DONE items in org-mode?

If of use: I came across Sacha's post that talks about how to do this. Based on the code in her post and on the feedback from the comments, I now use the code below (I have a light theme). You may ...
user avatar
  • 4,408
10 votes
Accepted

Cocoa Emacs 24.5 Font Issues (Inconsolata-dz)

Emacs doesn't allow fonts that have hyphens in them. I would rename the font to something that doesn't contain hyphens. You can do this using ttx. For example, assuming you have a font named ...
user avatar
  • 484
10 votes
Accepted

How to change face in particular theme locally?

Use custom-theme-set-faces in a with-eval-after-load to easily customize a theme. For example, this modifies ample-theme to have a lighter background and green keywords instead of the defaults. (...
user avatar
9 votes
Accepted

How to customize syntax highlight for just a given mode

Faces are global so changing its attributes anywhere changes it everywhere, as you've noticed. To change it locally, make a copy of the face, change the attributes in the copy and then use a mode ...
user avatar
  • 12.1k
9 votes
Accepted

How can I find out what face I need to change in the mode-line?

M-x list-faces-display shows you all of the faces currently defined, including those with names mode-line*. It shows you the appearance of each face. And it lets you customize any of them - just ...
user avatar
  • 69.7k
9 votes

Emacs Blue color too dark

Faces in Emacs can have different values, depending on display attributes such as the number of colors supported or whether they're displayed on a light/dark background. Emacs can guess the latter ...
user avatar
  • 21k
8 votes

How can I determine the width of characters on the screen?

The second element of the font-info is the font's pixelsize, which is (roughly speaking) its height. Getting the width of any particular glyph in the font is a little more work: (aref (aref (font-...
user avatar
  • 5,510
8 votes
Accepted

highlight-regexp in multiple buffers

Run M-x ibuffer to show all open buffers. Press m to mark buffers of interest (or one of the other more interesting marking commands). Press E to evaluate a lisp form in each marked buffer, for ...
user avatar
8 votes
Accepted

I-search prompt font

This is because isearch does not use the minibuffer to read input from the user, rather it simply updates the echo area with the characters entered during isearch. Please note that the minibuffer and ...
user avatar
  • 7,298
8 votes
Accepted

Disable enlarged org-mode header appearance

Org headings are controlled by the faces org-level-1, org-level-2 etc. You can get to them via M-x customize-face. Unselecting the height attribute should set them to the default font size.
user avatar
  • 20.3k
8 votes
Accepted

How to get/read face attributes?

You can use face-attribute. To match the example given, the following expression gets the trailing space background color: (face-attribute 'whitespace-trailing :background) face-attribute is a ...
user avatar
  • 5,765
8 votes
Accepted

something changes the default face in my .emacs

"Who's playing behind my back?" with respect to the most common choice of installing the GTK gui version of Emacs. The GTK build of Emacs supports GConf settings, which is what is causing the font ...
user avatar
  • 8,793
7 votes

How does AucTeX display superscripts?

Use the raise display property. As explained in (info "(elisp) Other Display Specs"): `(raise FACTOR)' This kind of display specification raises or lowers the text it applies to, relative ...
user avatar
  • 6,681
7 votes
Accepted

How can I determine the width of characters on the screen?

Here is the complete solution for my original problem. Thanks to @jch and @Malabarba for contributing the crucial pieces. (defun default-font-width () "Return the width in pixels of a character ...
user avatar
  • 2,440
7 votes

How can I set different font sizes for buffers and for the mode-line?

Thanks to the answer provided by itsjeyd I managed to write a short expression to change the size of all mode-line related faces for all current and future frames. If you're using other themes ...
user avatar
  • 1,723

Only top scored, non community-wiki answers of a minimum length are eligible