6

I had it once, and I cannot figure out how to turn it on again. In c++-mode (maybe in other modes as well), when I placed the cursor either right before an opening brace or right after it, apart from highlighting the braces themselves, emacs would also highlight the text which the pair surounds. How this feature called? How can I have it again?

Thnx!

| improve this question | | | | |
6
(show-paren-mode t)
(setq show-paren-style 'expression)

Emacs manual on show-paren-mode, however it does not mention show-paren-style. This emacs-fu blog post does.

| improve this answer | | | | |
3

The package 'mic-paren' does this, along with telling you where the matching paren is if it's not visible. Check it out here.

This is my preferred setup:

(setq paren-dont-touch-blink t)
(require 'mic-paren)
(paren-activate)
(setq paren-match-face 'highlight)
(setq paren-sexp-mode t))

Which does highlight the text between parens.

| improve this answer | | | | |
3

Are you thinking about hl-sexp mode.? I only use it for elisp mode. Never coded cpp.

enter image description here

| improve this answer | | | | |
  • This is very nice!! How ever not what I was looking for. I want something which highlight the region bounded between two matching braces only when the cursor is visiting either of the braces. Thanks anyway. I'll try what you linked to - it looks nice. – Dror Jul 1 '11 at 15:01
  • It was a long time but how do you enable such block highlighting? – Amumu Jul 16 '14 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.