1

Is there a way to get a word to be rendered with a different face in text mode?

Drew
  • 29,895
  • 7
  • 74
  • 104
Nathaniel Flath
  • 15,477
  • 19
  • 69
  • 94

2 Answers2

5

Check out `highlight-regexp'. Just type in the word you want to change the face for (although it can be any regular expression).

M-x highlight-regexp

highlight-regexp is an alias for `hi-lock-face-buffer' in
`hi-lock.el'.

It is bound to M-s h r.

(highlight-regexp regexp &optional face)

Set face of each match of regexp to face.

Interactively, prompt for regexp then face.  Buffer-local history
list maintained for regexps, global history maintained for faces.
Use M-p to retrieve previous history items,
and M-n to retrieve default values.
justinhj
  • 11,147
  • 11
  • 58
  • 104
1

Yes,

What you want is font-lock-mode.

See here: http://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html

Specifically you'll want to turn on font-lock-mode and then specify a list of keywords via font-lock-add-keywords.

chollida
  • 7,834
  • 11
  • 55
  • 85
  • Sure why not, you just need to add a hook for text-mode. I've just done it on my local machine. What don't you think is possible? – chollida Nov 05 '09 at 21:32