2

I have been looking on the web to the existing answers to this question, but non of them works for me.

I would like to change the default font size for all frames in Aquamacs 3.3 GNU Emacs 25.1.1 (x86_64-apple-darwin14.1.0, NS appkit-1344.72 Version 10.10.2 (Build 14C109)), and I am on OS X 10.11.2. I have tried to insert

(set-default-font “Terminus-9”)

in the .emacs file, but it does not work. Do you guys know how to do this?

Here is what I get if I follow the suggestion by lawlist below, i.e., put (add-to-list 'default-frame-alist '(font . "Terminus-9")) in the .emacs file, save the .emacs file and restart Aquamacs. Then, switch to the Messages buffer and type: M-x eval-expression RET (message "%s" (frame-parameters)) RET:

    16 environment variables imported from login shell (/bin/bash).
   [..]
 ((tool-bar-position . top) (parent-id) (explicit-name) (display . MacBook-Pro.local) (icon-name) (window-id . 1) (bottom-divider-width . 0) (right-divider-width . 0) (top . 23) (left . 0) (buried-buffer-list) (buffer-list *Messages*  *Minibuf-1* *scratch*) (unsplittable) (minibuffer . #<window 4 on  *Minibuf-0*>) (width . 201) (height . 48) (name .  *Minibuf-1*) (modeline . t) (fringe) (border-color . white) (mouse-color . white) (environment) (visibility . t) (cursor-color . black) (background-mode . light) (display-type . color) (window-system . ns) (fullscreen . maximized) (alpha) (scroll-bar-height . 0) (scroll-bar-width . 15) (cursor-type . box) (auto-lower) (auto-raise) (icon-type) (title) (buffer-predicate) (tool-bar-lines . 1) (menu-bar-lines . 1) (right-fringe . 11) (left-fringe . 3) (line-spacing) (background-color . #ffffff) (foreground-color . #000000) (horizontal-scroll-bars) (vertical-scroll-bars . right) (internal-border-width . 0) (border-width . 0) (font . -*-Monaco-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1) (fontsize . 0) (font-backend mac-ct))
    "((tool-bar-position . top) (parent-id) (explicit-name) (display . MacBook-Pro.local) (icon-name) (window-id . 1) (bottom-divider-width . 0) (right-divider-width . 0) (top . 23) (left . 0) (buried-buffer-list) (buffer-list *Messages*  *Minibuf-1* *scratch*) (unsplittable) (minibuffer . #<window 4 on  *Minibuf-0*>) (width . 201) (height . 48) (name .  *Minibuf-1*) (modeline . t) (fringe) (border-color . white) (mouse-color . white) (environment) (visibility . t) (cursor-color . black) (background-mode . light) (display-type . color) (window-system . ns) (fullscreen . maximized) (alpha) (scroll-bar-height . 0) (scroll-bar-width . 15) (cursor-type . box) (auto-lower) (auto-raise) (icon-type) (title) (buffer-predicate) (tool-bar-lines . 1) (menu-bar-lines . 1) (right-fringe . 11) (left-fringe . 3) (line-spacing) (background-color . #ffffff) (foreground-color . #000000) (horizontal-scroll-bars) (vertical-scroll-bars . right) (internal-border-width . 0) (border-width . 0) (font . -*-Monaco-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1) (fontsize . 0) (font-backend mac-ct))"
    You can run the command ‘eval-expression’ with ⌥:
    "((tool-bar-position . top) (parent-id) (explicit-name) (display . MacBook-Pro.local) (icon-name) (window-id . 1) (bottom-divider-width . 0) (right-divider-width . 0) (top . 23) (left . 0) (buried-buffer-list) (buffer-list *Messages*  *Minibuf-1* *scratch*) (unsplittable) (minibuffer . #<window 4 on  *Minibuf-0*>) (width . 201) (height . 48) (name .  *Minibuf-1*) (modeline . t) (fringe) (border-color . white) (mouse-color . white) (environment) (visibility . t) (cursor-color . black) (background-mode . light) (display-type . color) (window-system . ns) (fullscreen . maximized) (alpha) (scroll-bar-height . 0) (scroll-bar-width . 15) (cursor-type . box) (auto-lower) (auto-raise) (icon-type) (title) (buffer-predicate) (tool-bar-lines . 1) (menu-bar-lines . 1) (right-fringe . 11) (left-fringe . 3) (line-spacing) (background-color . #ffffff) (foreground-color . #000000) (horizontal-scroll-bars) (vertical-scroll-bars . right) (internal-border-width . 0) (border-width . 0) (font . -*-Monaco-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1) (fontsize . 0) (font-backend mac-ct))"
    Making completion list... [2 times]
    You can run the command ‘make-frame’ with s-N

The suggestion does not work, and I have the same font as before.

James
  • 121
  • 3
  • Here is a link to the manual that describes how to do this in the vanilla generic Emacs. Perhaps it works the same in Aquamacs: https://www.gnu.org/software/emacs/manual/html_node/emacs/Frame-Parameters.html – lawlist Oct 03 '18 at 14:35
  • @lawlist: Please consider posting the relevant info as an answer (it is the answer, IMO). Adding the link to the manual is an additional help. – Drew Oct 03 '18 at 14:57
  • @ lawlist I tried to include in the init file the three lines suggested in your link, it does not work. – James Oct 03 '18 at 16:32
  • Try putting this in your `.emacs` file: `(add-to-list 'default-frame-alist '(font . "Terminus-9"))`. Then, save the `.emacs` file and restart Aquamacs. Then, switch to the `*Messages*` buffer and type: `M-x eval-expression RET (message "%s" (frame-parameters)) RET` and see if it shows the `font` parameter as being set to `Terminus-9`. Then, type `M-x make-frame` and from within that **new** frame repeat the same steps as above to see what the `font` parameter is for that **new** frame. Then, report back here by editing your question or with a new comment to let us know the results. – lawlist Oct 03 '18 at 17:34
  • @lawlist done it, see my revised answer. – James Oct 04 '18 at 20:35
  • I have a computer capable of running Aquamacs, but I am not willing to install it on that computer because it puts stuff in locations that drive me absolutely crazy; e.g., in the HOME directory Library folder ... I would have been willing to install it on a scratch / unimportant disk running OSX 10.6.8, but the latest stable release of Aquamacs is incompatible. I would suggest trying the latest stable release of Aquamacs, which is 3.4 and using the settings mentioned in my previous comment. If that doesn't work, then you should probably send a bug report to the maintainer of Aquamacs. .... – lawlist Oct 06 '18 at 06:56
  • FYI: The generic/vanilla Emacs can do just about everything that Aquamacs can do. Several years ago, I extracted the NSspellchecker gizmo from Aquamacs and I modified the generic/vanilla version of Emacs to enable that feature. However, I have not updated the thread (containing that patch) to provide compatibility with Emacs 26. By using the vanilla/generic version of Emacs, you will find more people with the same setup that can provide help with problems you encounter. If you stick with Aquamacs, your support base will be quite limited ... – lawlist Oct 06 '18 at 07:02

2 Answers2

3

Personally, I want all Menlo all the time. I achieve this in Aquamacs with:

(when window-system
  (setq initial-frame-alist nil)   ;; Undo Aquamacs forced defaults
  (setq default-frame-alist nil)   ;; Undo Aquamacs forced defaults
  (aquamacs-autoface-mode -1)      ;; Use one face (font) everywhere
  (set-frame-font "Menlo-12")      ;; Set the default font to Menlo size 12
  ;;(set-default-font "Menlo-12")  ;; This would do the same.
)

Aquamacs sets some hard defaults that need to be undone before you can be successful changing faces. Setting initial-frame-alist and default-frame-alist to nil, also eliminate problems with themes, à la

(when window-system
  (setq initial-frame-alist nil)
  (setq default-frame-alist nil)
  (when (featurep 'aquamacs)
    (load-theme 'sanityinc-tomorrow-bright t))
  [...]
)

If you're still having font/face/theme issues, ensure that you don't have settings in a custom.el file, or in ~/Library/Preferences/Aquamacs Emacs/Preferences.el file, that could be conflicting with your init.el.

nega
  • 3,091
  • 15
  • 21
  • Thank you. What should I change in those lines to alter the size of the font? – James Oct 15 '18 at 21:31
  • @James the "12" represents the pixel size of the font. In your case I'd try doing `(set-frame-font "Terminus-9")` before messing with fontspecs. – nega Oct 17 '18 at 16:22
  • Ok, I included `(aquamacs-autoface-mode -1)` and ` (set-frame-font "Terminus-9")` in .emacs, and get the error message `Warning (initialization): An error occurred while loading ‘/Users/mcastellana/.emacs’:error: Font not available, # [...]` when emacs starts, and the font has not changed. – James Oct 18 '18 at 13:43
  • Do you have Terminus-9 installed? Do you have Terminus-12 installed? macOS doesn't come with a Terminus font. – nega Oct 18 '18 at 14:55
  • To get around this, I opened a document and found the font of the text with Alt + X + describe-char. I obtained `-*-Monaco-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x5B)'. Thus added `(set-frame-font "Monaco-12")` in .emacs and replaced `12` with various sizes. There is no error message when I open emacs, but the font does not change. – James Oct 22 '18 at 20:46
  • @james My bad! I neglected to include two settings that were elsewhere in my `init.el`. Please see my updated answer. – nega Oct 23 '18 at 15:11
  • Some font names have spaces in them: for 13pt JetBrains Mono, I put `"JetBrains Mono-13"`. – amacleod Jan 28 '20 at 14:54
0

I used James hint (M-x describe-char) to get the specs of my preferred font, then I used the value to customize default-frame-alist with it M-x customize-variable. No need to change anything in .emacs.

Stefan
  • 26,154
  • 3
  • 46
  • 84