Sunday, June 8, 2008

A better parentheses matching emacs package

For those who find the default parenthesis matching a bit lacking in features, the mic-paren package offers additional features that can be useful. I've been using it for quite some time and frankly, don't recall what I'd miss if I lose it. I mean, I've got used to thinking that this is the default behaviour of Emacs.

An indicative list of features from the package commentary...

  • Both forward and backward parenthesis matching (simultaneously if cursor is between two expressions).
  • Indication of mismatched parentheses.
  • Recognition of "escaped" (also often called "quoted") parentheses.
  • Option to match "escaped" parens too, especially in (La)TeX-mode(e.g., matches expressions like "\(foo bar\)" properly).
  • Offers two functions as replacement for `forward-sexp' and`backward-sexp' which handle properly quoted parens (s.a.). These new functions can automatically be bounded to the original binding of the standard `forward-sexp' and `backward-sexp' functions.
  • Option to activate matching of paired delimiter (i.e., characters withsyntax '$'). This is useful for writing in LaTeX-mode for example.
  • Option to select in which situations (always, never, if match, if mismatch) the entire expression should be highlighted or only the matching parenthesis.
  • Message describing the match when the matching parenthesis is off-screen(vertical and/or horizontal). Message contains either the linenumber orthe number of lines between the two matching parens. Option to select in which cases this message should be displayed.
  • Optional delayed highlighting (useful on slow systems),
  • Functions to activate/deactivate mic-paren.el are provided.
  • Numerous options to control the behaviour and appearance of mic-paren.el.
The package is also actively maintained and the latest version can be either found on the emacswiki site or at Thien's site.

1 comment:

Anonymous said...

Hello! This is extremely useful. Do you have tips of how to properly install it, via command line?