d12frosted / homebrew-emacs-plus

Emacs Plus formulae for the Homebrew package manager
MIT License
2.37k stars 184 forks source link

Emacs insists on using font Fira Code #520

Closed diktomat closed 2 months ago

diktomat commented 2 years ago

Please make sure to follow these steps (and mark the checkboxes):

What you were trying to do

Install and start Emacs.

What happened (include command output)

Trying to start freshly installed emacs, it complains about Fira Code not being defined. Setting the font to Menlo using -fn works and I can set the Font back to Fira (which I actually want to use) or any other font via M-x customize-face or the menu option just fine. However, when starting emacs again, it complains the same again as if not reading .emacs or init.el. When I put gibberish in one of whose files, it produces an error, so they are read, but setting the font doesn't work.

❯ rm -rf ~/.emacs ~/.emacs.d # make sure I don't set the font anywhere

❯ emacs
Font ‘Fira Code Regular Nerd Font Complete Mono’ is not defined

❯ fc-list |grep "Fira Code Regular Nerd Font Complete Mono" # it's actually installed:
/Users/bene/Library/Fonts/Fira Code Regular Nerd Font Complete Mono.ttf: FiraCode Nerd Font Mono:style=Regular
/Users/bene/Library/Fonts/Fira Code Regular Nerd Font Complete Mono Windows Compatible.ttf: FiraCode NFM:style=Regular

❯ emacs -fn Menlo
# starts, setting font to Monaco via M-x customize-face and saving...

❯ cat .emacs
(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 :extend nil :stipple nil :background "White" :foreground "Black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :foundry "nil" :family "Monaco")))))

❯ emacs
Font ‘Fira Code Regular Nerd Font Complete Mono’ is not defined

❯ echo "(some gibberish)" >> .emacs

❯ emacs -fn Menlo
# starts, tells error in .emacs

❯ mv .emacs .emacs.d/init.el

❯ emacs
Font ‘Fira Code Regular Nerd Font Complete Mono’ is not defined

❯ emacs -fn Menlo
# starts, tells error in init.el
brew install emacs
❯ brew reinstall emacs-plus
==> Downloading https://ftp.gnu.org/gnu/emacs/emacs-28.2.tar.xz
Already downloaded: /Users/bene/Library/Caches/Homebrew/downloads/2a0f4e37c90cb692b94247dc972284a34e494547eefa36784898ca3ea1391a1f--emacs-28.2.tar.xz
==> Reinstalling d12frosted/emacs-plus/emacs-plus@28 
==> Patching
==> Applying fix-window-role.patch
patching file src/nsterm.m
Hunk #1 succeeded at 8583 (offset -185 lines).
==> Applying system-appearance.patch
patching file src/frame.h
patching file src/nsfns.m
Hunk #1 succeeded at 1315 (offset 59 lines).
patching file src/nsterm.m
Hunk #1 succeeded at 1878 (offset -11 lines).
Hunk #2 succeeded at 5389 (offset -6 lines).
Hunk #3 succeeded at 5635 (offset -6 lines).
Hunk #4 succeeded at 5685 (offset -6 lines).
Hunk #5 succeeded at 5911 (offset -6 lines).
Hunk #6 succeeded at 8916 (offset 14 lines).
Hunk #7 succeeded at 10102 (offset 44 lines).
==> ./autogen.sh
==> ./configure --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp --infodir=/opt/homebrew/Cellar/emacs-plus@28/28.2/share/info/emacs --prefix=/opt/homebrew/Cellar/emacs-plus@28/28.2 -
==> gmake
==> gmake install
==> Injecting PATH value to Emacs.app/Contents/Info.plist
Patching plist at /opt/homebrew/Cellar/emacs-plus@28/28.2/Emacs.app/Contents/Info.plist with following PATH value:
/opt/homebrew/bin
/opt/homebrew/sbin
/Users/bene/.local/share/go/bin
/Users/bene/.local/share/cargo/bin
/Users/bene/.local/bin
/usr/local/bin
/Library/Apple/usr/bin
/usr/local/MacGPG2/bin
/Library/TeX/texbin
/Applications/kitty.app/Contents/MacOS
/usr/bin
/bin
/usr/sbin
/sbin
==> /usr/libexec/PlistBuddy -c 'Add :LSEnvironment dict' '/opt/homebrew/Cellar/emacs-plus@28/28.2/Emacs.app/Contents/Info.plist'
==> /usr/libexec/PlistBuddy -c 'Add :LSEnvironment:PATH string' '/opt/homebrew/Cellar/emacs-plus@28/28.2/Emacs.app/Contents/Info.plist'
==> /usr/libexec/PlistBuddy -c 'Set :LSEnvironment:PATH /opt/homebrew/bin:/opt/homebrew/sbin:/Users/bene/.local/share/go/bin:/Users/bene/.local/share/cargo/bin:/Users/bene/.local/bin:/usr/loca
==> /usr/libexec/PlistBuddy -c 'Print :LSEnvironment' '/opt/homebrew/Cellar/emacs-plus@28/28.2/Emacs.app/Contents/Info.plist'
==> touch '/opt/homebrew/Cellar/emacs-plus@28/28.2/Emacs.app'
==> Caveats
Emacs.app was installed to:
  /opt/homebrew/opt/emacs-plus@28

To link the application to default Homebrew App location:
  ln -s /opt/homebrew/opt/emacs-plus@28/Emacs.app /Applications

Your PATH value was injected into Emacs.app/Contents/Info.plist

Report any issues to http://github.com/d12frosted/homebrew-emacs-plus

To start d12frosted/emacs-plus/emacs-plus@28 now and restart at login:
  brew services start d12frosted/emacs-plus/emacs-plus@28
Or, if you don't want/need a background service you can just run:
  emacs
==> Summary
🍺  /opt/homebrew/Cellar/emacs-plus@28/28.2: 4,101 files, 138MB, built in 1 minute 2 seconds
==> Running `brew cleanup emacs-plus@28`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

❯ ln -s /opt/homebrew/opt/emacs-plus@28/Emacs.app /Applications

Output of brew config

❯ brew config
HOMEBREW_VERSION: 3.6.5-16-g8684f95
ORIGIN: https://github.com/Homebrew/brew
HEAD: 8684f953f621db5f1a1eed0477f34b0ee5315ed1
Last commit: 43 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 2b5fff20f9d76fb8ba4c722e1cfc303eba49b816
Core tap last commit: 27 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: nvim
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.37.0 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.6-arm64
CLT: 14.0.0.0.1.1661618636
Xcode: 14.0.1
Rosetta 2: false

Output of brew doctor

❯ brew doctor
Your system is ready to brew.
d12frosted commented 2 years ago

Please try running Emacs using emacs -Q. You might still have some custom configurations in other places, for example, ~/.config/emacs or $XDG_CONFIG_HOME/emacs.

diktomat commented 2 years ago
❯ emacs -Q
Font ‘Fira Code Regular Nerd Font Complete Mono’ is not defined

Also, I just tried railwaycat/emacsmacport. Without doing anything but uninstalling emacs-plus und installing emacs-mac, it worked. Uninstalling that and installing this one again, problem is back. So I think it must be some issue with emacs-plus, not emacs itself.

Also, just tried uninstalling homebrew/cask-fonts/font-fira-code-nerd-font. Starts flawlessly after uninstalling, fails again after reinstalling. Uninstalling this unfortunately is no option, as it's the best font in the known universe..

d12frosted commented 2 years ago

Can you please try running https://emacsformacos.com/ ? emacsmacport has lots of modifications to make it more macOS friendly, and I am curious if it's GNU Emacs issue or just Emacs+. Sorry to ask you for this, it's just that I never faced this issue (and I don't have Fira Code installed).

diktomat commented 2 years ago

Didn't know this one, and it's even in default Homebrew.. Anyway, it fails the same way as this one, so it appears to be an upstream issue after all.