Next: , Previous: , Up: Editing Lisp   [Contents][Index]


8.6 Parenthesis Matching

Lisp mode is parenthesis matching. Two different styles of parenthesis matching are supported: highlighting and pausing.

Hemlock Variable: Highlight Open Parens (initial value t)
Hemlock Variable: Open Paren Highlighting Font (initial value nil)

When Highlight Open Parens is true, and a close paren is immediately before the point, then Hemlock displays the matching open paren in Open Paren Highlighting Font.

Open Paren Highlighting Font is the string name of the font used for paren highlighting. Only the "(" character is used in this font. If null, then a reasonable default is chosen. The highlighting font is read at initialization time, so this variable must be set before the editor is first entered to have any effect.

Command: Lisp Insert ) (bound to ) in Lisp mode)
Hemlock Variable: Paren Pause Period (initial value 0.5)

This command inserts a close parenthesis and then attempts to display the matching open parenthesis by placing the cursor on top of it for Paren Pause Period seconds. If there is no matching parenthesis then beep. If the matching parenthesis is off the top of the screen, then the line on which it appears is displayed in the echo area. Paren pausing may be disabled by setting Paren Pause Period to nil.

The initial values shown for Highlight Open Parens and Paren Pause Period are only approximately correct. Since paren highlighting is only meaningful in Lisp mode, Highlight Open Parens is false globally, and has a mode-local value of t in Lisp mode. It it redundant to do both kinds of paren matching, so there is also a binding of Paren Pause Period to nil in Lisp mode.

Paren highlighting is only supported under X windows, so the above defaults are conditional on the device type. If Hemlock is started on a terminal, the initialization code makes Lisp mode bindings of nil and 0.5 for Highlight Open Parens and Paren Pause Period. Since these alternate default bindings are made at initialization time, the only way to affect them is to use the after-editor-initializations macro.


Next: Parsing Lisp, Previous: Indentation, Up: Editing Lisp   [Contents][Index]