Emacs: Highlight Brackets ()[]{}

By Xah Lee. Date: . Last updated: .

Alt+x show-paren-mode → highlight matching brackets when your cursor is on one of the bracket.

;; turn on highlight matching brackets when cursor is on one
(show-paren-mode 1)

show-paren-mode has 2 styles of highlighting brackets.

emacs show paren mode parenthesis 33045
Alt+x show-paren-mode, highlight brackets
emacs show paren mode expression 46552
Alt+x show-paren-mode, highlight whole expression

By default, emacs highlights just the brackets.

To change a style, put this in your emacs init file:

;; highlight brackets
(setq show-paren-style 'parenthesis)

;; highlight entire expression
(setq show-paren-style 'expression)

;; highlight brackets if visible, else entire expression
(setq show-paren-style 'mixed)

Note: show-paren-mode will highlight any brackets, including [] {} 『』 【】 〈〉 «» etc.

[see Unicode: Brackets, Quotes «»「」【】《》]

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys


ELisp Examples

ELisp Write Major Mode

Emacs Init

Init Basics


text editing