在不创建主题的情况下更改emacs中特定文本的颜色 [英] Changing the color of a specific piece of text in emacs without creating a theme
问题描述
是否可以选择要编辑的文本并更改其颜色?我知道可以创建一种颜色主题来为某些类型的文本着色(例如,某种编程语言中的着色功能),但是可以一次更改特定emacs中所选文本的颜色没有创建主题的文档?
Is it possible to select a piece of text you're editing and change its color? I know it's possible to create a color theme that will color certain kinds of text (like for example coloring functions in a certain programming language), but is it possible to do a one time color change to a selected piece of text in a specific emacs document without creating a theme? thanks in advance.
推荐答案
在任何情况下,主题都不允许您指定任意文本的颜色。
A theme doesn't allow you to specify the color of arbitrary text in any case. It only describes a set of face to be used by font-lock.
要将脸部应用于任意文本,请选择文本 >,然后 M-: (add-text-properties(region-beginning)(region-end)'(face font-lock-warning-face))
To apply a face to an arbitrary piece of text, select the text, then M-: (add-text-properties (region-beginning) (region-end) '(face font-lock-warning-face))
有关如何创建面孔的信息,请参见elisp手册的 faces部分。
See the faces section of the elisp manual on how to create a face.
Emacs还带有 hi-lock
软件包,该软件包可以突出显示正则表达式或包含正则表达式的行。参见手册
Emacs also comes with the hi-lock
package, which can highlight regexps or lines containing regexps. See manual
这篇关于在不创建主题的情况下更改emacs中特定文本的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!