Next: Comments Prev: Program Indent Up: Programs
Automatic Display Of Matching Parentheses
The Emacs parenthesis-matching feature is designed to show
automatically how parentheses match in the text. Whenever you type a
self-inserting character that is a closing delimiter, the cursor moves
momentarily to the location of the matching opening delimiter, provided
that is on the screen. If it is not on the screen, some text near it is
displayed in the echo area. Either way, you can tell what grouping is
being closed off.
In Lisp, automatic matching applies only to parentheses. In C, it
applies to braces and brackets too. Emacs knows which characters to
regard as matching delimiters based on the syntax table, which is set
by the major mode. Note: Syntax.
If the opening delimiter and closing delimiter are mismatched--such
as in `[x)'--a warning message is displayed in the echo area. The
correct matches are specified in the syntax table.
Two variables control parenthesis match display.
`blink-matching-paren' turns the feature on or off; `nil' turns it off,
but the default is `t' to turn match display on.
`blink-matching-paren-distance' specifies how many characters back to
search to find the matching opening delimiter. If the match is not
found in that far, scanning stops, and nothing is displayed. This is
to prevent scanning for the matching delimiter from wasting lots of
time when there is no match. The default is 12,000.
When using X Windows, you can request a more powerful kind of
automatic parenthesis matching by loading the `paren' library. To load
it, type `M-x load-library RET paren RET'. This library turns off the
usual kind of matching parenthesis display and substitutes another:
whenever point is after a close parenthesis, the close parenthesis and
its matching open parenthesis are both highlighted; otherwise, if point
is before an open parenthesis, the matching close parenthesis is
highlighted. (There is no need to highlight the open parenthesis after
point because the cursor appears on top of that character.)
automatically generated by info2www