Search code examples
emacsemacs-faces

Emacs text-mode highlighting


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


Solution

  • 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.