Emacs/OSX Default font setting does not persist

允我心安 提交于 2019-12-21 03:39:13

问题


I'm using Emacs 23.2. When I change the default font using Options --> Set Default Font... it correctly switches to the font that I select. I then do Options --> Save Options to make it permanent.

It writes a stanza to the end of my .emacs, but it's empty, doesn't contain anything about the font. Also, in the minibuffer it says "Loading battery...done" which seems a bit weird. And when I restart Emacs, the font is back to the default, which is Monaco. Similarly, changing the font size does not persist, but other (non-font-related) customizations do persist.

Anyone seen this? Anyone know how to make the font setting permanent?


回答1:


Try M-x customize-face RET default, adjust to your liking, then 'Save for future sessions'.

Edit: For example, that adds the following stanza to my (custom-set-faces) in .emacs:

(custom-set-faces
  '(default ((t (:inherit nil :stipple nil :background "White" :foreground "Black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 130 :width normal :family "Consolas"))))
  ...

If all you want to so is set the font size & family (13pt Consolas in this example), this appears to be sufficient:

  '(default ((t (:height 130 :family "Consolas"))))



回答2:


Only way I got it to work was to modify manually the .emacs file:

(custom-set-faces                                                                                    
 '(default ((t (:height 150 :family "Menlo"))))
 )

PS: I'm on Yosemite




回答3:


I have the same issue. I think it is because Emacs do not have the permission to edit the custom.el, this file is read only in emacs. So I use sudo vim ~/.emacs.d/custom.el to edit it, and it work well.



来源:https://stackoverflow.com/questions/4821984/emacs-osx-default-font-setting-does-not-persist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!