0

In my .emacs I have

(set-frame-font "Source Code Pro")
(set-face-attribute 'default nil :font "Source Code Pro" :height 140)
(set-face-font 'default "Source Code Pro")

Which sets the fonts to source code pro. To do its job, this code apparently needs to run once after the first frame has been created. How can I achieve that?

  • I'm on MacOS and use emacs-plus.
  • Emacs Deamon is started on boot as a service, I only ever call emacsclient.
  • If I run this code once, all new frames have the right fonts.
  • If Emacs Daemon restarts, I need to run the code again, but after the first frame has been created.
  • Putting it in .emacs runs it too early so it's not working.
  • If I start emacs as emacs, not as the deamon, the code in .emacs works and the first frame uses Source Code Pro.

How can I set the fonts or other frame parameters on deamon start?

  • 3
    set-frame-font and similar like having an actual frame to work with, which is why you should set and save the value of the default face using M-x customize-face, which will set the appropriate values that will be used by new graphical frames (where do people get these set-frame-font invocations from?) – rpluim Jul 23 at 12:11
0

It sounds like you would need a function to run once per server invocation.

You can probably use the information in this post to help you set up a hook that would run a function to set the fonts, and then not run that function for subsequent frames until the next time the server is (re)started.

| improve this answer | |

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.