设置emacs的外观

emacs的外观包括文本区的外观,辅助区的外观,状态行的外观,光标的外观等,

每个外观都有名字,并且都有下面属性:

  • Font Family: 字体名字
  • Font Foundry: ?
  • Width: 字体宽度
  • Height: 字体宽度
  • Weight: 字体重
  • Slant: 斜体
  • Underline: 下划线
  • Overline: 上划线
  • Strike-through: 透过线
  • Box around text: ?
  • Inverse-video: ?
  • Foreground: 前景色
  • Background: 背景色
  • Stipple: ?
  • Inherit: 继承别的外观

如何设置外观呢?emacs通过【Face】的东西来设置

face的定义:face可以定义字体,颜色等。大多数主编辑模式(major mode)分配各种face给函数名,注释,变量,关键字等,通过【Font Lock mode】。【Font Lock mode】的说明在后面。

Emacs can display text in several different styles, called faces. Each face can specify various face attributes, such as the font, height, weight, slant, foreground and background color, and underlining or overlining. Most major modes assign faces to the text automatically, via Font Lock mode.

注意:face里并不设定所有属性,没有被设定的属性就使用叫default的face的属性。比如face:popup-face,它只设定了前景色和背景色属性,所有它的其他属性的值就是face:default的相应属性的值。

这个概念非常重要,所以当改变了face:default里属性的值的话,就会影响所有face

list-faces-display :查看系统里有所有face

list-colors-display :查看系统里所有的颜色的名字和RGB值

set-face-foreground :改变指定face里的前景色(先输入要改变的face的名字,然后再输入颜色的名字)

set-face-background:改变指定face里的背景色(先输入要改变的face的名字,然后再输入颜色的名字)

ctrl h v 变量A:查看变量A的作用

Font Lock mode:

Font Lock mode is a minor mode, always local to a particular buffer, which assigns faces to (or fontifies) the text in the buffer. Each buffer's major mode tells Font Lock mode which text to fontify; for instance, programming language modes fontify syntactically relevant constructs like comments, strings, and function names.

Font Lock mode is enabled by default in major modes that support it. To toggle it in the current buffer, type M-x font-lock-mode.

font-lock-mode :作用在当前缓冲区

global-font-lock-mode:作用在当前缓冲区

Font Lock mode uses several specifically named faces to do its job, including font-lock-string-facefont-lock-comment-face, and others. The easiest way to find them all is to use

M-x customize-group 回车 font-lock-faces 回车. You can then use that customization buffer to customize the appearance of these faces.

从下图可以看出来:

1,关键字(font lock keyward face)后面是紫色,所以右面代码里关键字(template,protected,try等)部分全是紫色

2,函数名(font lock function name face)后面是蓝色,所以右面代码里函数名(insert,get_node等)部分全是蓝色

如何在上面的画面操作请参考Changing a Variable

注意:当通过用emacs改变变量的值后,会自动在.emacs里插入下面的代码。

(custom-set-variables
;; custom-set-variables 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.
)

注意:当通过用emacs改变face的设定后,会自动在.emacs里插入下面的代码。

;;设置face:default的背景色为黑色,前景色为白色,字体大小为218
(custom-set-faces
;; custom-set-variables 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.
)

注意:custom-set-facescustom-set-variables在.emacs里只能出现一次。

c/c++ 学习互助QQ群:877684253

本人微信:xiaoshitou5854

emacs 设置emacs的外观的更多相关文章

  1. emacs设置了单例模式后无法设定文件关联解决办法

    emacs设置单例模式的本质就是使用下列参数启动: C:\emacs-24.5\bin\emacsclientw.exe --no-wait --alternate-editor="C:\e ...

  2. emacs设置字体

    * C-h f set-default-font set-default-font is an alias for `set-frame-font' in `frame.el'. (set-defau ...

  3. Emacs: 设置窗口标题格式

    Emacs默认的窗口标题常常比较简单,例如我的默认标题是"emacs@ubuntu".如果想要在标题中显示更多的信息,我们可以对它进行一些设置.由于Emacs的可扩展性,这种修改实 ...

  4. emacs - GNU Emacs

    总览 (SYNOPSIS) emacs [ command-line switches ] [ files ... ] 描述 (DESCRIPTION) GNU Emacs 是 Emacs 的 一个 ...

  5. emacs 配置.emacs

    emacs 配置.emacs (require 'package) (package-initialize) (add-to-list'package-archives '("melpa&q ...

  6. iOS 11开发教程(十九)iOS11应用视图美化按钮之设置按钮的外观

    iOS 11开发教程(十九)iOS11应用视图美化按钮之设置按钮的外观 美化按钮说白了就是对按钮的属性进行设置,设置按钮的属性有两种方法:一种是使用编辑界面中的属性检查器:另一种是使用代码进行设置.以 ...

  7. 设置emacs启动窗口的两种方法

    1. 设置位置和大小 ;;设置窗口位置为屏库左上角(0,0) (set-frame-position (selected-frame) 0 0) ;;设置宽和高 (set-frame-width (s ...

  8. emacs设置tab缩进

    这两天使用Emacs自带的JavaScriptMode时,发现与其它编辑器下缩进不同,而且用emacs重新缩进对齐后,再用其它的编辑器打时缩进却乱掉了.分析应该是Tab缩进的问题,在.emacs中增加 ...

  9. mac系统下为emacs设置中文字体,解决乱码问题

    近期换了个系统,如今用mac系统. 当打开emacs后,中文支持的不是非常好.有的地方能显示.在.el文件的凝视里显示为口口口口口口口口这种框.例如以下图所看到的 找了半天.是由于中文字体的问题.仅仅 ...

随机推荐

  1. Android Gradle 学习笔记(四):Gradle 构建脚本

    本节我们从整体的角度来介绍一下Gradle. 一.setting.gradle 在Gradle中,定义了一个设置文件,用于初始化以及工程树的配置.设置文件的默认的名字就是setting.gradle, ...

  2. cssW3c书写规范

    书写规范:{ 1.选择器名和{大括号之间必须空格(p {}) 2.属性名与之后的:之间不允许空格,:与属性值之间必须空格( p{font-size: 20px;}) 3.并集选择器的每个选择器声明必须 ...

  3. jmeter控制器(三)

    While Controllert当控制器: 当满足条件的情况下,就会执行控制器里面的脚本,首先我们设置线程组循环次数为10,如下图: 其次在配置元件中添加一个计数器,并设置从0到最大的10,每次递增 ...

  4. Linux下磁盘实战操作命令

    企业真实场景由于硬盘常年大量读写,经常会出现坏盘,需要更换硬盘.或者由于磁盘空间不足,需添加新硬盘,新添加的硬盘需要经过格式化.分区才能被 Linux 系统所使用. 虚拟机 CentOS 7 Linu ...

  5. Druid-代码段-1-5

    所属文章:池化技术(一)Druid是如何管理数据库连接的? 本代码段对应流程1.4,抛弃连接: //丢弃连接 public void discardConnection(Connection real ...

  6. 【python3基础】python3 神坑笔记

    目录 os 篇 os.listdir(path) 运算符篇 is vs. == 实例 1:判断两个整数相等 实例 2:argparse 传参 实例 3:np.where 命令行参数篇 Referenc ...

  7. GNS3 2.18 + ASA(IOU)

    使用软件及版本 地址:https://www.gns3.com/ gns3: 2.1.18 ASA:asa842-initrd asa842-vmlinuz 一.gns3 vm安装 1.安装 注意:启 ...

  8. LeetCode 307. 区域和检索 - 数组可修改

    地址 https://leetcode-cn.com/problems/range-sum-query-mutable/ 题目描述给定一个整数数组  nums,求出数组从索引 i 到 j  (i ≤  ...

  9. 题解:P2130 狂奔的Wzf

    题目链接 solution 判断有无障碍的时候不需要以此枚举,利用前缀和,如果前缀为零证明没有障碍. 重复很多,写的很丑了,#3死活不过 #include<iostream> #inclu ...

  10. BZOJ1001/LG4001 「ICPC Beijing2006」狼抓兔子 平面图最小割转对偶图最短路

    问题描述 BZOJ1001 LG4001 题解 平面图最小割=对偶图最短路 假设起点和终点间有和其他边都不相交的一条虚边. 如图,平面图的若干条边将一个平面划分为若干个图形,每个图形就是对偶图中的一个 ...