Die Standardschriftart von Emacs funktioniert nicht mit neuen Frames

Die Standardschriftart von Emacs funktioniert nicht mit neuen Frames

Ich habe diesen Code in meiner .emacs-Datei (set-default-font "Monaco 16"). Wenn ich Emacs starte, wenn es nicht geöffnet ist (zum Beispiel indem ich auf die Verknüpfung klicke), beginnt es mit Monaco 16, aber wenn ich einen neuen Rahmen damit erstelle, C-x 5 2beginnt es mit der alten Standardschriftart, die für mich zu klein zum Lesen ist. Gibt es eine Möglichkeit, das zu umgehen?



BEARBEITEN

Beim Laden gibt Emacs einen Fehler aus und das Problem scheint bei (set-default-font "Monaco 16" nil t) in meinem zu liegen .emacs. Was ist falsch? Ich kopiere die Emacs-Debug-Kopie:

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()

Antwort1

set-default-fontist veraltet. Aber trotzdem klingt es so, als würde es für Sie das tun, was in der Doc-Zeichenfolge steht. So wie du es nennst,es sollte die Schriftart ändernnur für das aktuelle Bild.

Wenn Sie möchten, dass die Standardschriftart für alle Frames geändert wird, übergeben Sie sie tals drittes Argument. Beispiel: (set-default-font "Monaco 16" nil t).

Tun Sie dies C-h f set-default-font, und Sie werden etwa Folgendes sehen:

,----
| 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.
`----

Antwort2

Wenn dies bei einer GUI-Version von Emacs nicht funktioniert, liegt wahrscheinlich ein Konflikt mit einer anderen Einstellung vor:

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

Antwort3

In Emacs 24.3 auf Mac OS X 10.9 (set-frame-font "Monaco 10" nil t)schlägt es bei mir mit einem „falsche Anzahl von Argumenten“-Fehler fehl, aber (set-frame-font „Monaco 10“) funktioniert. Allerdings ist es nur im ausgewählten/anfänglichen Frame wirksam.

Zum Glück (set-face-attribute 'default nil :font "Monaco 10")funktioniert es bei mir und ist in allen Frames effektiv.

Antwort4

Eine Problemumgehung besteht darin, anzupassen 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)

„Wenden Sie“ es dann für diese Sitzung an (und testen Sie es, indem Sie einen neuen Frame öffnen C-x 5 2) und „Wenden und speichern“ Sie es in Ihrer Initialisierungsdatei.

verwandte Informationen