Function: highlight-regexp

highlight-regexp is a function alias and interactive for hi-lock-face-buffer, defined in hi-lock.el.gz.

Signature

(highlight-regexp REGEXP &optional FACE SUBEXP LIGHTER)

Documentation

Set face of each match of REGEXP to FACE.

Interactively, prompt for REGEXP using hi-lock-read-regexp, then FACE. Use the global history list for FACE. Limit face setting to the corresponding SUBEXP (interactively, the prefix argument) of REGEXP. If SUBEXP is omitted or nil, the entire REGEXP is highlighted.

LIGHTER is a human-readable string that can be used to select a regexp to unhighlight by its name instead of selecting a possibly complex regexp or closure.

If REGEXP contains upper case characters (excluding those preceded by \) and search-upper-case is non-nil, the matching is case-sensitive.

Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, use overlays for highlighting. If overlays are used, the highlighting will not update as you type. The Font Lock mode is considered "enabled" in a buffer if its major-mode causes font-lock-specified-p to return non-nil, which means the major mode specifies support for Font Lock.

View in manual

Probably introduced at or before Emacs version 21.1.

Key Bindings

Aliases

highlight-regexp