Hot answers tagged

15

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 font-lock-mode is enabled, it will strip any text of the face property. The following piece of code works, if font-lock mode is disabled: (let ((current-...


14

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, you'll want to change the sizes (14 and 10) to values of your liking. If you want to customize a specific face and don't know the name of it, try doing M-x ...


13

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-lock-warning-face))) The problem, I imagine, is that you're evaluating your snippet with something like eval-last-sexp (C-x C-e). This function (and its brethren) ...


13

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, with priority character in the car and faces in the cdr. The face can be a symbol, a color as as a string, or a property list of attributes, like (:...


11

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 console or are doing emacs -nw in a terminal, instead of clicking, put the cursor on the appropriate element and press RET.


10

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 overlays to bracketed links." (if (and (re-search-forward org-bracket-link-regexp limit t) (not (org-in-src-block-p))) (let* ((hl (org-match-...


10

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 applied elsewhere. Thus, (setq-local face-remapping-alist '((stripe-highlight (:background "white" :foreground "black")))) is not considered to be the preferred ...


10

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 org-level-2 org-level-3 org-level-4 org-level-5)) (set-face-attribute face nil :weight 'semi-bold ...


9

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-line-format. Buffer: If the face is in a region of the buffer you can't reach, see the value of (buffer-string). Minibuffer: If point is currently in the ...


9

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. Then the only question was how to use my custom defface instead of the original. I'll use the same example of overriding the stripe-hl-line face to walk through ...


9

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 bugs #20253, #15899, and #16192.


8

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 hook to locally set the old face to the copy on a per-buffer basis. The sample below does it for font-lock-comment-face, but the same incantation will work for ...


8

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 note lazy loading, this prevents an 'undefined' error at start up as per a comment in original blog post: (defun my/modify-org-done-face () (setq org-fontify-...


8

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 example, (highlight-regexp "regexp-custard" 'hi-yellow) You can save the patterns for a particular file with hi-lock-write-interactive-patterns (Default binding: ...


8

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 Inconsolata-dz for Powerline.otf in your current working directory: # Convert the font to ttx format (an xml-like font format) ttx "Inconsolata-dz for Powerline.otf" #...


8

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 the echo area are different. From the GNU Emacs Manual The echo area is used for displaying error messages (see Errors), for messages made with the message ...


8

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. (with-eval-after-load "ample-theme" (custom-theme-set-faces 'ample '(default ((t (:foreground "#bdbdb3" :background "gray15")))) '(font-lock-keyword-face ...


7

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 besides the default one (such as zenburn, etc.), the code should be put after you've declared the theme; i.e., after this line: (load-theme 'solarized-light t) ...


7

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 the same.


7

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-get-glyphs (font-at (point)) 65 66) 0) 4)


7

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 to the baseline of the line. FACTOR must be a number, which is interpreted as a multiple of the height of the affected text. If it is positive, that ...


7

From make-mode.el, line 395 and forwards (Emacs 24.4.1): ,@(if space '(;; Highlight lines that contain just whitespace. ;; They can cause trouble, especially if they start with a tab. ("^[ \t]+$" . makefile-space) ;; Highlight shell comments that Make treats as commands, ;; since these can fool people. ("^\t+#" 0 makefile-space t) ...


7

You can customize indicate-empty-lines to enable a fringe marker on lines after the end of the file, or call toggle-indicate-empty-lines to turn it on and off interactively. There's a package on MELPA that replaces the default fringe indicator with a ~ for a look that is closer to what you get with vi. See vi-tilde-fringe. Updated An alternative approach ...


7

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.


6

You can also achieve this using rainbow-mode, which is part of ELPA. Install it with M-x package-install rainbow-mode and activate it with M-x rainbow-mode. It seems that the color changes don't occur until you edit the buffer.


6

The Problem The problem here is that there’s no face to control the appearance of the margins. You can display text in the margin using overlays (that’s what linum-mode does) but, like any text in Emacs, it’s constrained to the limits of the buffer. So you can’t have any control over the margin display beyond the last line of the buffer. What you can do, ...


6

minibuffer-setup-hook is used only when the minibuffer is set up, i.e., activated, not when it is deactivated. minibuffer-exit-hook takes effect when the minibuffer is exited. There is also minibuffer-inactive-mode-hook. But although those do initiate the color change (as shown by adding (debug) at the beginning of the hook function, and then stepping ...


6

Turns out this is actually related to org-block-background face, which has been removed in org version 8.3.1 in commit f8b42e8, thus the bug. The rationale seems to be it causes a bug with ps export it's inefficient Maybe in the future there will be an alternative, but not yet. https://stackoverflow.com/questions/26290924/fontify-r-code-blocks-in-org-...


6

Here a example of customization (setq org-priority-faces '((?A . (:foreground "red" :weight 'bold)) (?B . (:foreground "yellow")) (?C . (:foreground "green"))))


6

Sure you can, (see this SO question) although it seems a bit heavy-handed. (defun nadvice/message-color (old-fun &optional str &rest args) (if (not str) (funcall old-fun) (funcall old-fun "%s" (propertize (apply #'format str args) 'face '(:foreground "red"))))) (advice-add 'message :around #'nadvice/...


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