1

I have emacs25 build from source (25.0.95).

And the only configure in my init.el is:

(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 (:family "Ubuntu Mono" :foundry "DAMA" :slant normal :weight normal :height 241 :width normal)))))

But when I open emacs, the font is not changed, if I eval that code manually after emacs is opened, the font is changed.

I also tried this:

(add-hook 'after-init-hook (lambda ()
                 (if (display-graphic-p)
                 (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 (:family "Ubuntu Mono" :foundry "DAMA" :slant normal :weight normal :height 241 :width normal))))))))

The font is still not changed.

Tried solution from @ManuelUberti, still doesn't work for me. And I also notice when I open emacs, screen has a quick flash which looks like the font is changed (bigger), but some how it seems changed back to default.

  • I set my default font using one of the techniques mentioned in the above linked thread: Setting emacs*font: Monoid in ~/.Xdefaults followed by xrdb -merge ~/.Xdefaults in the terminal. To keep things clean, if you use this .Xdefault or .Xresources method, remove all default font customizations from your emacs config. – Kaushal Modi Jul 21 '16 at 14:15
  • How did you build Emacs? The possible ways to configure fonts depend on which GUI framework you choose when you run ./configure. – Gilles 'SO- stop being evil' Jul 23 '16 at 8:54
0

I build Emacs from sources too, but this also works on Emacs installed using the package manager on Fedora 23:

(set-face-attribute 'default nil
                    :family "Source Code Pro"
                    :height 130)
0

You can try this

(when (member "DejaVu Sans Mono" (font-family-list))
  (set-face-attribute 'default nil :font "DejaVu Sans Mono"))

or

(when (member "DejaVu Sans Mono" (font-family-list))
    (add-to-list 'initial-frame-alist '(font . "DejaVu Sans Mono-10"))
    (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10")))
0

I set font in my .emacs like so :- (set-frame-font "PragmataPro 13")

Not the answer you're looking for? Browse other questions tagged or ask your own question.