Function: hi-lock-face-phrase-buffer

hi-lock-face-phrase-buffer is an autoloaded, interactive and byte-compiled function defined in hi-lock.el.gz.

Signature

(hi-lock-face-phrase-buffer REGEXP &optional FACE)

Documentation

Set face of each match of phrase REGEXP to FACE.

Interactively, prompt for REGEXP using read-regexp, then FACE. Use the global history list for FACE.

If REGEXP contains upper case characters (excluding those preceded by \) and search-upper-case is non-nil, the matching is case-sensitive. Also set search-spaces-regexp to the value of search-whitespace-regexp.

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.

Key Bindings

Aliases

highlight-phrase

Source Code

;; Defined in /usr/src/emacs/lisp/hi-lock.el.gz
;;;###autoload
(defun hi-lock-face-phrase-buffer (regexp &optional face)
  "Set face of each match of phrase REGEXP to FACE.
Interactively, prompt for REGEXP using `read-regexp', then FACE.
Use the global history list for FACE.

If REGEXP contains upper case characters (excluding those preceded by `\\')
and `search-upper-case' is non-nil, the matching is case-sensitive.
Also set `search-spaces-regexp' to the value of `search-whitespace-regexp'.

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."
  (interactive
   (list
    (hi-lock-regexp-okay
     (read-regexp "Phrase to highlight" 'regexp-history-last))
    (hi-lock-read-face-name)))
  (or (facep face) (setq face 'hi-yellow))
  (unless hi-lock-mode (hi-lock-mode 1))
  (hi-lock-set-pattern
   regexp face nil nil
   (if (and case-fold-search search-upper-case)
       (isearch-no-upper-case-p regexp t)
     case-fold-search)
   search-whitespace-regexp))