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 these commands:
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-nil
value causes this command (and other Hi Lock commands that read faces)
to automatically choose the next face from the default list without
prompting.
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-lines-matching-regexp
).
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-symbol-at-point
).
hi-lock-write-interactive-patterns
command.)
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 hi-lock-find-patterns
).
hi-lock-find-patterns
). Thus, you can enter patterns
interactively with highlight-regexp
, store them into the file
with hi-lock-write-interactive-patterns
, edit them (perhaps
including different faces for different parenthesized parts of the
match), and finally use this command (hi-lock-find-patterns
) to
have Hi Lock highlight the edited patterns.
The variable 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
is ask
. Note that patterns are always highlighted if you call
hi-lock-find-patterns
directly, regardless of the value of this
variable.
Also, hi-lock-find-patterns
does nothing if the current major
mode's symbol is a member of the list hi-lock-exclude-modes
.