我还想在.emacs文件中保存字体大小。


当前回答

我有以下在我的。emacs:

(defun fontify-frame (frame)
  (set-frame-parameter frame 'font "Monospace-11"))

;; Fontify current frame
(fontify-frame nil)
;; Fontify any future frames
(push 'fontify-frame after-make-frame-functions) 

你可以用你选择的任何字体来代替“Monospace-11”。可用选项集高度依赖于系统。使用M-x set-default-font并查看制表符补全会给您一些启发。在我的系统上,在启用了Emacs 23和抗锯齿的情况下,可以根据名称选择系统字体,例如Monospace、Sans Serif等。

其他回答

在X11中打开emacs,进入菜单选项,选择“设置默认字体…”,更改字体大小。在同一菜单中选择“保存选项”。完成了。

从Emacswiki, GNU Emacs 23有一个内置的键组合:

C-xC-+和C-xC-增加或 减小缓冲区文本大小

zoom.cfg和global-zoom.cfg提供字体大小更改绑定(来自EmacsWiki)

C——或C-mousewheel-up:增大字体大小。 C-+或C-鼠标滚轮向下:减小字体大小。 C-0将字体大小恢复为默认值。

M-x自定义脸RET默认将允许您设置脸的默认脸,所有其他脸的基础上。在这里你可以设置字体大小。

这是我的。emacs中的内容。实际上,color-theme会设置基础,然后我的自定义面部设置会覆盖一些东西。定制的set-faces是由emacs的定制面机制编写的:

;; my colour theme is whateveryouwant :)
(require 'color-theme)
(color-theme-initialize)
(color-theme-whateveryouwant)

(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 (:stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
 '(font-lock-comment-face ((t (:foreground "darkorange4"))))
 '(font-lock-function-name-face ((t (:foreground "navy"))))
 '(font-lock-keyword-face ((t (:foreground "red4"))))
 '(font-lock-type-face ((t (:foreground "black"))))
 '(linum ((t (:inherit shadow :background "gray95"))))
 '(mode-line ((t (nil nil nil nil :background "grey90" (:line-width -1 :color nil :style released-button) "black" :box nil :width condensed :foundry "unknown" :family "DejaVu Sans Mono")))))

Aquamacs:

(set-face-attribute 'default nil :font "Monaco-16" )

从Emacs Wiki全局更改默认字体,它说你可以使用以下任何一种:

(set-face-attribute 'default nil :font FONT )

(set-frame-font FONT nil t)

其中FONT是“Monaco-16”之类的东西,例如:

(set-face-attribute 'default nil :font "Monaco-16" )

在wiki上的第一个建议中有一个额外的右括号,这导致了启动时的错误。我终于注意到这个额外的右括号,随后我在维基上更正了这个建议。这两个建议都对我有用。