2

I have this code in my .emacs file (set-default-font "Monaco 16"). When I start emacs when it is not open (by clicking on the shortcut for instance) it starts with Monaco 16 but when I create a new frame with C-x 5 2 it starts with the old default font, which is too small to read for me. Is there a way around this?



EDIT

When loading emacs throws an error and the problem appears to be with (set-default-font "Monaco 16" nil t) in my .emacs. What is wrong? I copy the emacs debug copy:

Debugger entered--Lisp error: (wrong-number-of-arguments #[(font-name &optional$
\203^X^@\305\304\306\"\307 _^Q\305\304\310\"\311 _^P\312\313 \314^KBC\"\210
\2039^@\312\313 \306\315        \307 \"B\310\315^H\311 \"BD\"\210*\316\317\320\$
  set-default-font("Monaco 16" nil t)
  eval-buffer(#<buffer  *load*> nil "/Users/a/.emacs" nil t)  ; Reading at buff$
  load-with-code-conversion("/Users/a/.emacs" "/Users/a/.emacs" t t)
  load("~/.emacs" t t)
  #[nil "^H\205\276^@   \306=\203^Q^@\307^H\310Q\202A^@ \311=\2033^@\312\307\31$
  command-line()
  normal-top-level()
3

set-default-font is deprecated. But anyway, it sounds like it is doing for you what the doc string says. The way you are calling it, it should change the font only for the current frame.

If you want it to change the default font for all frames, then pass it t as the third argument. For example: (set-default-font "Monaco 16" nil t).

Do C-h f set-default-font and you will see something like this:

,----
| set-default-font is an alias for `set-frame-font' in `frame.el'.
| 
| (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 use
| that font on the selected frame.  When called from Lisp, FONT
| should be a font name (a string), a font object, font entity, or
| font spec.
| 
| If KEEP-SIZE is nil, keep the number of frame lines and columns
| fixed.  If KEEP-SIZE is non-nil (or with a prefix argument), try
| to keep the current frame size fixed (in pixels) by adjusting the
| number of lines and columns.
| 
| If FRAMES is nil, apply the font to the selected frame only.
| If FRAMES is non-nil, it should be a list of frames to act upon,
| or t meaning all graphical frames.  Also, if FRAME is non-nil,
| alter the user's Customization settings as though the
| font-related attributes of the `default' face had been "set in
| this session", so that the font is applied to future frames.
`----
1

If this doesn't work for a GUI version of Emacs, then another setting is likely conflicting with it:

(set-face-attribute 'default nil :background "black" :foreground "white"
  :font "Courier" :height 180)
0

In Emacs 24.3 on Mac OS X 10.9, (set-frame-font "Monaco 10" nil t) fails for me with a "wrong number of arguments" error, but (set-frame-font "Monaco 10") succeeds. However, it's only effective in the selected/initial frame.

Thankfully, (set-face-attribute 'default nil :font "Monaco 10") works for me and is effective in all frames.

0

See accepted answer from: Emacs font settings not working in new frame

ie:

(add-to-list 'default-frame-alist
             '(font . "Source Code Pro-15:style=Light"))

retains the specified font across new frames, confirmed under Emacs 24.4

0

One workaround is to customize default-frame-alist. C-h v default-frame-alist click 'customize' If there is no 'font' paramater, click 'INS' and add `font` as the Parameter. As the value, add "Monaco 16" (the double quotes are essential)

Then 'Apply' it for this session, (and test it by opening a new frame C-x 5 2) and 'Apply and Save' it to your initialization file.

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.
{"cc_re__cc_re__cc_by_sa_3_0": ["-item\"><a href=\"https://twitter.com/stackoverflow\" class=\"-link js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 32 })\">Twitter</a></li>\r\n                    <li class=\"-item\"><a href=\"https://linkedin.com/company/stack-overflow\" class=\"-link js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 33 })\">LinkedIn</a></li>\r\n                </ul>\r\n\r\n                <p class=\"mt-auto mb24\">\r\nsite design / logo &#169; 2019 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" class=\"js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 34 })\" rel=\"license\">cc by-sa 3.0</a>\r\n                            with <a href=\"https://stackoverflow.blog/2009/06/25/attribution-required/\"  class=\"js-gps-track\" data-gps-track=\"footer.click({ location: 2, link:35 })\" rel=\"license\">attribution required</a>.\r\n                    <span id=\"svnrev\">rev&nbsp;2019.8.20.34647</span>\r\n                </p>\r\n            </div>\r\n        </div>\r\n\r\n            </footer>\r\n            <script>StackExchange.ready(function () { StackExchange.responsiveness.addSwitcher(); })</scri"], "copyright__copyright__copyright": ["t click 'customize' If there is no 'font' paramater, click 'INS' and add `font` as the Parameter. As the value, add \"Monaco 16\" (the double quotes are essential)\n\nThen 'Apply' it for this session, (and test it by opening a new frame C-x 5 2) and 'Apply and Save' it to your initialization file.\n\nYour Answer\n\nBy clicking \u201cPost Your Answer\u201d, you agree to our terms of service, privacy policy and cookie policy\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}