4

I just upgraded Emacs to 25.1.1 (via the Arch Linux package manager pacman).

Now I can't set the font size in my .emacs anymore.

I am able to adjust it via C-x C-+ and C-x C--, and I can also use M-x customize to set the default font height to 83 instead of 103. This works for my current session in all buffers, then.

But when I save the generated config code (attached below) in my .emacs and restart, the settings are ignored and Emacs starts with the default font size instead. I am confused as to where to start searching for the cause of the problem, since it works if I adjust it in each session, but does not work when restarting Emacs.

There is no error message and nothing of help in the *Messages* buffer.

Where can I start looking for the problem?

I must add that I have no idea about how Emacs-Lisp works and can only copy-paste things into my config file. It's a very confusing language for me.

(custom-set-variables
 ;; custom-set-variables 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.
 )
(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 (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 83 :width normal :foundry "PfEd" :family "DejaVu Sans Mono"))))
 '(tabbar-button ((t (:inherit tabbar-default :foreground "dark red"))))
 '(tabbar-button-highlight ((t (:inherit tabbar-default))))
 '(tabbar-default ((t (:inherit variable-pitch :background "#959A79" :foreground "black" :weight bold))))
 '(tabbar-highlight ((t (:underline t))))
 '(tabbar-selected ((t (:inherit tabbar-default :background "#95CA59"))))
 '(tabbar-separator ((t (:inherit tabbar-default :background "#95CA59"))))
 '(tabbar-unselected ((t (:inherit tabbar-default)))))
5
  • I had the same problem. To solve this I put this in my .emacs :- (set-frame-font "PragmataPro 13"). Put the font-name followed by the font-size in the quotes. Thats it. Commented Sep 19, 2016 at 16:59
  • How did you set the faces? Did you add those lines to the .emacs file or you just set it with customize-faces and clicked Apply and Save?
    – caisah
    Commented Sep 19, 2016 at 18:21
  • caisah: I used customize and let it add it to my .emacs automatically Commented Sep 19, 2016 at 18:35
  • Chakravarthy: Thank you! The command set-frame-font worked. I had to find a super long string for my desired font via xfontsel in Linux, according to here: emacswiki.org/emacs/SetFonts Commented Sep 19, 2016 at 18:43
  • Chakravarthy: Okay, update: It does not work if I open a new frame with C-x 5 2. The new frame will have the old font that I don't want... Commented Sep 21, 2016 at 13:59

2 Answers 2

6

This is most likely an instance of Emacs bug#25228 - custom-set-faces from init file ~/.emacs ignored. Basically Emacs is applying gconf settings which override your customization (Emacs versions prior to 25.1 apparently had some bug which prevented the settings from applying at all). To disable gconf updates, add this your .emacs:

(define-key special-event-map [config-changed-event] #'ignore)
3
  • It's odd that the conversation around that bug took place in December 2016, but GNU Emacs 25.2.2, apparently released in September 2017, still does not include a fix for this bug. Commented May 3, 2018 at 10:54
  • @TeemuLeisti Right, the bug is still open. Nobody has proposed a fix.
    – npostavs
    Commented May 3, 2018 at 11:15
  • OK. Anyway, your solution works for me, hence the upvote. Commented May 4, 2018 at 12:16
0

You can use this command to increase the font size,

(set-face-attribute 'default nil :height 165)

It works for me on Mac - Emacs 25.1.50

5
  • For me, unfortunately, it doesn't work. If I try to enter the command via M-x set-face-attribute, it can't even be found. The only one that I can call is set-face-font. This one would work within a session, but also not within a startup file Commented Sep 19, 2016 at 17:55
  • It is not a command, it's a function. You can't call it via M-x - you have to evaluate the entire elisp expression. Press M-: to bring up a dialogue for evaluating short expressions, or paste it into an elisp buffer and evaluate it using M-x eval-last-sexp.
    – JCC
    Commented Sep 20, 2016 at 19:33
  • Oh! It works with M-:, but not if I put this line in my (otherwise empty) .emacs. Do you know why that would make a difference? Commented Sep 23, 2016 at 8:15
  • 1
    This may be another instance of Emacs bug#25228 - custom-set-faces from init file ~/.emacs ignored
    – npostavs
    Commented Dec 19, 2016 at 13:48
  • @MadhavanKumar The bug affects GNU Emacs running on a GNOME desktop, so Macs won't be affected, so while the set-face-attribute command in your init file works for you, it won't work on affected systems. Commented May 4, 2018 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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