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


当前回答

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

其他回答

我使用hydra包通过按f2 + + + +/f2 - - - -连续控制字体增减,这意味着按f2一次,然后使用+/-来控制,并恢复默认字体大小f2 0。因为我有键盘,所以我也绑定键盘到字体设置。

(defhydra hydra-zoom (global-map "<f2>")
  "zoom"
  ("<kp-add>" text-scale-increase "in")
  ("+" text-scale-increase "in")
  ("-" text-scale-decrease "out")
  ("<kp-subtract>" text-scale-decrease "out")
  ("0" (text-scale-set 0) "reset")
  ("<kp-0>" (text-scale-set 0) "reset"))

而现代编辑器的鼠标控制功能由以下键绑定支持,按下控制键+鼠标滚轮可增加/减少字体。

(global-set-key (kbd "<C-wheel-up>") 'text-scale-increase)
(global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease)

这完全取决于你所说的改变字体大小。 EmacsWiki部分提供了最好和最完整的信息。它区分了各种情况(文本缩放,框架字体,缓冲区/框架等):改变字体大小。

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

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

这是另一个简单的解决方案。《24小时》也适用

(set-default-font "Monaco 14")

捷径:

`C-+` increases font size
`C--` Decreases font size

在AquaMacs CMD +和CMD -中调整当前缓冲区的字体大小。