
我的 .emacs 檔案中有此程式碼(set-default-font "Monaco 16")
。當我在未打開的情況下啟動 emacs 時(例如通過單擊快捷方式),它以 Monaco 16 開頭,但是當我創建一個新框架時,C-x 5 2
它以舊的默認字體開頭,該字體太小而無法閱讀。有沒有解決的辦法?
編輯
載入 emacs 時拋出錯誤,問題似乎出在我的.emacs
.怎麼了?我複製 emacs 調試副本:
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()
答案1
set-default-font
已棄用。但無論如何,聽起來它正在為您做文檔字串所說的事情。 按照你所說的方式,它應該改變字體僅適用於當前幀。
如果您希望它更改所有框架的預設字體,請將其t
作為第三個參數傳遞。例如:(set-default-font "Monaco 16" nil t)
。
這樣做C-h f set-default-font
你會看到類似這樣的東西:
,----
| 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.
`----
答案2
如果這不適用於 GUI 版本的 Emacs,則另一個設定可能與其衝突:
(set-face-attribute 'default nil :background "black" :foreground "white"
:font "Courier" :height 180)
答案3
在 Mac OS X 10.9 上的 Emacs 24.3 中,(set-frame-font "Monaco 10" nil t)
由於「參數數量錯誤」錯誤而失敗,但 (set-frame-font "Monaco 10") 成功。但是,它僅在選定/初始幀中有效。
值得慶幸的是,(set-face-attribute 'default nil :font "Monaco 10")
它對我有用並且在所有框架中都有效。
答案4
一種解決方法是自訂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)
然後將此會話「套用」(並透過開啟新框架來測試它C-x 5 2
)並將其「套用並儲存」到您的初始化檔案中。