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
emacs show-paren-mode, highlight brackets
emacs show paren mode expression 46552
emacs show-paren-mode, highlight whole expression

By default, emacs highlights just the brackets. You can change it with the following code:

;; 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 () [] {} 「」 『』 【】 〖〗 〈〉 《》 ‹› «» ….

Working with Brackets Topic

  1. Emacs: Highlight Brackets ({[]})
  2. Emacs: Insert Brackets by Pair
  3. Emacs: Delete Parenthesis/Brackets ()[]{} by Pair
  4. Emacs: Select Line, between Quotes, Extend Selection
  5. Emacs: Move Cursor to Bracket/Quote

Emacs Lisp Basics Topic

  1. Emacs Lisp Basics
  2. Overview of Text-Processing in Emacs Lisp
  3. Emacs Lisp Examples, page 1
  4. How to Evaluate Emacs Lisp Code
  5. Elisp: Documentation Lookup
  6. Elisp: Search Documentation
  7. How to Edit Lisp Code with Emacs
Liket it? Put $1 at patreon. Or Buy Xah Emacs Tutorial. Thanks.