在每个缓冲区/模式下设置Emacs defaut字体 [英] Set Emacs defaut font face per-buffer/mode

查看:173
本文介绍了在每个缓冲区/模式下设置Emacs defaut字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改Emacs在每个模式下使用的风格文本的默认面孔?

How do you change the default face which Emacs uses to style text on a per-mode basis?

例如,说我已经对脸好了我有自定义,其中包括默认的固定宽度字体。但是,在一个特定的模式( markdown-mode.el ,说),我想要默认的字体是可变宽度。

For example, say that I am already happy with the face customizations that I have, which include a default fixed-width font. However, in one particular mode (markdown-mode.el, say), I want the default font to be variable-width.

容易将标题,链接等唯一地标记为markdown-mode:只需将光标放在样式文本和 Mx describe-face 上,然后单击链接来定制它。

It is easy to style headers, links etc. uniquely for markdown-mode: simply place the cursor over the styled text and M-x describe-face, then click the link to customize it.

然而,默认面是如果没有指定其他脸部时使用的脸部,所以它不是特定于降价模式,如果修改将影响所有其他模式。

However, the default face is the face used if no other face is specified, so it is not specific to markdown-mode and if modified will affect all other modes.

我可以在 markdown-mode-hook 中放置什么魔法来设置默认的脸对于使用此模式的缓冲区?

What magic can I put in the markdown-mode-hook to set the default face for buffers using this mode?

推荐答案

这样的事情如何:

(add-hook 'markdown-mode-hook (lambda () (variable-pitch-mode t))

然后,您可以自定义变量间距面,缓冲区中的其他面会从此继承,而不是默认面。

You can then customize the variable-pitch face, and the other faces in the buffer will inherit from this instead of the default face.

阅读 buffer-face-mode 的文档,以获取更多的定制细节。 (BufFace也用于 text-scale-increase text-scale-decrease ...非常有用。)

Read the docs for buffer-face-mode for more customization details. (BufFace is also used for text-scale-increase and text-scale-decrease... very useful.)

这篇关于在每个缓冲区/模式下设置Emacs defaut字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆