7

Debian Sid, emacs25, cinnamon 3.2.7

In my ~/.emacs I have

(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 [...] :foundry "microsoft" :family "Consolas")))))

When I login in X using, e.g. xfce and start emacs I have that the default face uses Consolas as I want, when I login using cinnamon and start emacs I have that the default face uses LucidaTypewriter (that is a bitmapped font)!

In the second case M-x customize-face RET default RET shows me a customization buffer where the font family is LucidaTypewriter, while in my ~/.emacs I still have a reference to Consolas.

«edit1»
I forgot to mention: if I evaluate the custom-set-faces form, as it is stored inside my .emacs, during a Cinnamon session the default face is reversed from LucidaTypewriter to Consolas as expected.

I have no problems on the Emacs side (at least I hope so...), I just want to understand what is happening and, possibly, avoid the small inconvenience of resetting the face to my liking.
«/edit1»

«edit2» I'm going to address some questions raised in a comment (thank you @jimmij).

  1. Usually I start Emacs from the panel, the command that is used is always (i.e., in Cinnamon and in XFCE)

    /usr/bin/emacsclient -c -a ""
    

    but if in a Cinnamon session I start Emacs from the command line I have exactly the same behaviour ("wrong" font).

  2. The ~/.emacs file is correctly evaluated (I see all my customizations) and no error is reported.

  3. The *Messages* buffer

    Loading 00debian-vars...done
    Loading /etc/emacs/site-start.d/50asymptote.el (source)...done
    Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
    Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
    Loading debian-ispell...
    Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
    Loading debian-ispell...done
    Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
    Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
    Loading /etc/emacs/site-start.d/50slime.el (source)...
    Loading /usr/share/emacs/site-lisp/slime/slime-autoloads.el (source)...done
    Loading /etc/emacs/site-start.d/50slime.el (source)...done
    Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)...done
    For information about GNU Emacs and the GNU system, type C-h C-a.
    Mark set
    
  4. Re X resources database

    $ xrdb -q | grep -i emacs | grep -vi xemacs
    $
    

    I have no resources concerning Emacs, irrespective of who set them.

«/edit2»

Who's playing behind my back? and how could I preempt their move?


ps the [...] ellipsis in the code snippet just stays for a long sequence of default values.


---------------------------- UPDATE -----------------------------
ps (writing 24h later) installing the emacs25-lucid package "solved" my problem, in the sense that now a freshly started Emacs uses Consolas — however, this at least leaves open my question "Who's playing behind my back?" with respect to the most common choice of installing the GTK gui version of Emacs.

  • What happens when you directly set consolas in the cinamon session? (place cursor at the last parenthesis and run C-x C-e). – jimmij May 6 '17 at 15:43
  • @jimmij "What happens when you directly set consolas in the cinnamon session?" The default face uses again Consolas (I've edited my Q). – gboffi May 6 '17 at 19:09
  • And how do you start emacs, from terminal or graphical interface? If the later then check what command hide underneath. It looks as if .emacs file was not evaluated , perhaps it was invoked with -q option? Other things to check are a Messages buffer (pehaps there are some errors) and .Xresources/.Xdefaults files (although I believe settings from .emacs should override them). – jimmij May 6 '17 at 22:04
  • @jimmij Thank you for the good questions, Being unable to reply in the format of a comment I have edited my question. – gboffi May 7 '17 at 9:58
  • Does (define-key special-event-map [config-changed-event] 'ignore) help? (refer debbugs.gnu.org/cgi/bugreport.cgi?bug=25228#152) – npostavs May 7 '17 at 23:27
7

"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 change "behind your back". To disable GConf settings add this to your .emacs:

(define-key special-event-map [config-changed-event] 'ignore)

Prior to Emacs 25.1 the font setting via GConf was broken somehow, which prevented this issue from showing before then. See also Bug#25228.

  • 1
    gconftool-2 --dump / | grep -i lucida and variations of that command produce an empty string... I piped the output to less and looked at all the instances of font — the only references are to Sans 10 and Monospace 10 but fc-match thinks that Sans is Vera.ttf and Monospace is VeraMono.ttf so I'd give an arm (figuratively) to know where that LucidaTypewriter came from or, more to the point, I will accept the answer... OTOH ignoring the config-changed-event did the trick of preventing GConf from doing its evil, so thank you very much, ciao – gboffi May 8 '17 at 15:33
  • @gboffi you can try debugging the dynamic-setting-handle-config-changed-event function to see why it happens, it looks like it might be using (font-get-system-font) instead of any explicit font setting to decide the new font. – npostavs May 8 '17 at 16:05
  • In the scratch buffer, (font-get-system-font) evaluates to "Monospace 11" — that's interesting because, according to gconftool-2, the system monospaced font is "Monospace 10" but this could be related, as in the bug report you've mentioned, to slightly different ideas of the screen resolution. Re debugging, from the same bug report it looks not something at the elisp level but requiring a binary with debugging symbols and a bit of practice with gdb so I give up. – gboffi May 8 '17 at 22:17
  • Thanks a lot! This was driving me crazy: I could see my theme face appear in a glimpse and disappear a fraction of second later... From the bug report you cite, comment 20: "Such configuration settings should never override anything specified by the user in her .emacs." This was more than 2 years ago... :-( – L. Levrel Feb 3 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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