Highlight Changes mode is a minor mode that highlights the parts of the buffer that were changed most recently, by giving that text a different face. To enable or disable Highlight Changes mode, use M-x highlight-changes-mode.
Hi Lock mode is a minor mode that highlights text that matches
regular expressions you specify. For example, you can use it to
highlight all the references to a certain variable in a program source
file, highlight certain parts in a voluminous output of some program,
or highlight certain names in an article. To enable or disable Hi
Lock mode, use the command M-x hi-lock-mode. To enable Hi Lock
mode for all buffers, use M-x global-hi-lock-mode or place
(global-hi-lock-mode 1) in your .emacs file.
Hi Lock mode works like Font Lock mode (see Font Lock), except that you specify explicitly the regular expressions to highlight. You control them with the commands described below. (The key bindings below that begin with C-x w are deprecated in favor of the global M-s h bindings, and will be removed in some future Emacs version.)
Highlight text that matches regexp using face face
highlight-regexp). The highlighting will remain as long as
the buffer is loaded. For example, to highlight all occurrences of
the word “whim” using the default face (a yellow background)
M-s h r whim RET RET. Any face can be used for
highlighting, Hi Lock provides several of its own and these are
pre-loaded into a list of default values. While being prompted
for a face use M-n and M-p to cycle through them.
Setting the option
hi-lock-auto-select-face to a non-
value causes this command (and other Hi Lock commands that read faces)
to automatically choose the next face from the default list without
You can use this command multiple times, specifying various regular expressions to highlight in different ways.
Unhighlight regexp (
If you invoke this from the menu, you select the expression to unhighlight from a list. If you invoke this from the keyboard, you use the minibuffer. It will show the most recently added regular expression; use M-n to show the next older expression and M-p to select the next newer expression. (You can also type the expression by hand, with completion.) When the expression you want to unhighlight appears in the minibuffer, press RET to exit the minibuffer and unhighlight it.
Highlight entire lines containing a match for regexp, using face
Highlight matches of phrase, using face face
highlight-phrase). phrase can be any regexp,
but spaces will be replaced by matches to whitespace and
initial lower-case letters will become case insensitive.
Highlight the symbol found near point, using the next available face
Insert all the current highlighting regexp/face pairs into the buffer
at point, with comment delimiters to prevent them from changing your
program. (This key binding runs the
These patterns are extracted from the comments, if appropriate, if you
invoke M-x hi-lock-find-patterns, or if you visit the file while
Hi Lock mode is enabled (since that runs
Extract regexp/face pairs from comments in the current buffer
hi-lock-find-patterns). Thus, you can enter patterns
highlight-regexp, store them into the file
hi-lock-write-interactive-patterns, edit them (perhaps
including different faces for different parenthesized parts of the
match), and finally use this command (
have Hi Lock highlight the edited patterns.
hi-lock-file-patterns-policy controls whether Hi
Lock mode should automatically extract and highlight patterns found in a
file when it is visited. Its value can be
nil (never highlight),
ask (query the user), or a function. If it is a function,
hi-lock-find-patterns calls it with the patterns as argument; if
the function returns non-
nil, the patterns are used. The default
ask. Note that patterns are always highlighted if you call
hi-lock-find-patterns directly, regardless of the value of this
hi-lock-find-patterns does nothing if the current major
mode’s symbol is a member of the list