Hot answers tagged

33

I have the following in my .emacs using Emacs for OSX: (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. '(default ((t (:stipple nil :background "white" :foreground "black"...


22

buffer-face-set and buffer-face-mode in Emacs 23 or later is designed for exactly this. From the Emacs wiki: ;; Use variable width font faces in current buffer (defun my-buffer-face-mode-variable () "Set font to a variable width (proportional) fonts in current buffer" (interactive) (setq buffer-face-mode-face '(:family "Symbola" :height 100 :...


20

I use this in my init.el: ;; Set default font (set-face-attribute 'default nil :family "Source Code Pro" :height 110 :weight 'normal :width 'normal) You could try the same using Inconsolata instead of Source Code Pro.


15

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


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


12

If you changed something in .Xresources file then you need to reread it to see any changes in current session. To keep your old resources settings and apply new one: xrdb -merge ~/.Xresources To throw away your old resources and apply only settings from .Xresources: xrdb ~/.Xresources Adjustments in .Xresources file are better, because they are applied ...


11

If you want to use a GUI font picker with previews and all, you may use M-x menu-set-font


10

emacs for now doesn't support ligatures (on OSX there is some support, but not on other platforms). However, emacs 24.4+ supports prettify-symbols-mode which in some ways is better than normal ligatures support. That mode allows to subsitute for display any regex with any glyph. I am personnally using this snippet to get Fira Code ligatures to work in emacs ...


10

Maybe use a buffer-local value for face-remapping-alist to remap default to something else in that one buffer? See C-hig (elisp) Face Remapping RET e.g.: (face-remap-add-relative 'default :family "Monospace") or in a file-local variable block. e.g.: ;; Local Variables: ;; eval: (face-remap-add-relative 'default :family "Monospace") ;; End:


10

You're not doing anything wrong. Emacs for Linux uses XFT for font rendering, and XFT doesn't yet support the color fonts. See this mailing list thread from Dec 2015. Richard Stallman writes in that thread that it's a low priority and they don't care about color fonts. Also in that thread you can see that they disabled color fonts in Emacs for Mac, not for ...


9

Some themes change faces for no good reason. For example, if you are using Solarized theme add code below before loading it. (setq solarized-use-variable-pitch nil solarized-scale-org-headlines nil)


9

One solution is to modify org-indent-strings to use stars instead of spaces as the indentation character. This means that the width of the indentation will always be correct, even when using a proportional font. The trick then is to set the foreground color of the indentation to be the same as the background color, so that the stars become invisible. We ...


9

set-default-font by default sets the font for current frame only from the documentation C-hfset-default-fontRET (emphasis mine) (set-default-font FONT &optional KEEP-SIZE FRAMES) This function is obsolete since 23.1; use `set-frame-font' instead. Set the default font to FONT. When called interactively, prompt for the name of a font, and ...


9

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" #...


9

Customize LaTeX-font-list: M-x customize-variable RET LaTeX-font-list RET. Select Math Prefix: for ^C key (the prefix C-c C-f is omitted) and add \mathscr{ to "Math Prefix:" field and } to "Math Suffix".


8

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)


8

Yes. What you want is to zoom (the font size for) a frame, regardless of which buffers are displayed there. See library zoom-frm.el, and these descriptions of zooming a frame and zooming a buffer. See, in particular, command zoom-in/out, which does both. It is bound by default to the keys normally bound to just buffer zooming: C-x C-+, C-x C--, C-x C-0, ...


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

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.


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

This occurs because Emacs uses different fonts for different parts of the Unicode character set. You can verify what font is being used by positioning the cursor over a character and pressing C-u C-x =. For instance, with my configuration over an ASCII character I get nil:-apple-Consolas-medium-normal-normal-*-14-*-*-*-m-0-iso10646-1 (#x88), but over a ⧺ I ...


7

Yes. You can put a function on after-make-frame-functions (or perhaps make-frame-functions) that tests which display (monitor) is used and adjusts the frame's default font height (size) appropriately. That function can use function display-monitor-attributes-list to determine which display is used. It can then change the size of the frame's font, if ...


6

I use agda-mode with a lot of mathematical symbols and have had the same problem. Used to be the only real solution was as @shosti suggests: customizing the font mappings. In my case, I had to disable a number of fonts because even though I had fonts installed with particular glyphs defined, emacs would often choose the wrong one (displaying boxes). Seemed ...


6

To help you track it next time This happened to me before. There was a situation where string-to-int crashed Emacs, and it took me hours to pinpoint as well. Sorry I can't provide a nicer answer, but Emacs crashes happen deep down in the C code, and there aren't any built-in tools available to track down such problems. I suppose debugging it with gdb is ...


6

This always works whenever I want to try other fonts (put it in your init.el or .emacs file): (push '(font . "Inconsolata") default-frame-alist) or (add-to-list 'default-frame-alist '(font . "Inconsolata")) In this case both expressions are equivalent. In short, these forms set the font for the current and all future Emacs frames. Since these are saved ...


6

This is all-but-a-dupe of this question on SO. As of this writing, the accepted answer over there is (mutatis mutandis): (set-face-attribute 'org-verbatim nil :inherit 'fixed-pitch) EDIT: Actually read your question. Since you want to change multiple faces, this is a more complete answer: (dolist (face '(org-block-begin-line org-block-...


6

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 in the current window's default font. More precisely, this returns the width of the letter ‘m’. If the font is mono-spaced, this will also be the width of all ...


6

Playing with Emacs’ fontsets definitions should be the answer. After reading Fontsets docs: The startup fontset will use the font that you specify, or a variant with a different registry and encoding, for all the characters that are supported by that font, and fallback on ‘fontset-default’ for other characters. If some characters appear on ...


6

What you want to do is to set the display-table entry for character LEFT-TO-RIGHT EMBEDDING to the glyph that is used for character SECTION SIGN. (aset (or (window-display-table) standard-display-table) 8234 ; 0x202A, which is the char LEFT-TO-RIGHT EMBEDDING (vector (make-glyph-code ?§))) If the selected window has its own display table, then ...


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