M-x all-things-emacs

Quick Tip: show-paren-mode

August 7th, 2007 by Rob Christie · 115 Comments

When show-paren-mode is enabled a matching parenthesis is highlighted based on the location of point (i.e., when your cursor is on a parenthesis). show-paren-mode Example
You can tweak the behaviour of this minor mode by adjusting show-paren-style and the show-paren-delay. There are three styles to choose from:

  • parenthesis – shows the matching paren
  • expression – shows the entire expression enclosed by the paren, and
  • mixed – shows the matching paren if it is visible, and the expression otherwise.

To obtain this behaviour, add the following to your .emacs file:

(show-paren-mode t)

Tags: newbie · quick · tips

115 responses so far ↓

  • 1 Eric // Aug 8, 2007 at 9:44 am

    Again, thanks for pointing out a simple but incredibly useful feature. I have been using paren matching for a very long time but had never investigated the options available. Being able to highlight the expression and not just the parentheses themselves is a very useful feature.

  • 2 pqs // Oct 5, 2009 at 1:47 pm

    This should be activated by default!