I'm using Spacemacs, and I REALLY love how Dr. Racket background highlights parentheses as you move around.
I'm wondering if I can do this in Emacs instead of this God forsaken "rainbow delimiters" that give me a headache.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI'm using Spacemacs, and I REALLY love how Dr. Racket background highlights parentheses as you move around.
I'm wondering if I can do this in Emacs instead of this God forsaken "rainbow delimiters" that give me a headache.
With show-paren-mode
you can highlight the whole expression. You need to have the following code in your init file. You can try different style and choose what you like to highlight.
(show-paren-mode t) ;; enable show paren mode
(setq show-paren-style 'expression) ;; highlight whole expression
Refer : http://emacs-fu.blogspot.in/2009/01/balancing-your-parentheses.html
'expression
does that mean its unavailable? It doesn't seem to be working. I noticed it autocompletes show-paren-style
but not the value.
– Tallboy
Jan 2 '18 at 3:33
expression
is an arbitrary, unbound symbol in this case. If show-paren-style
hadn't previously been defined as a variable, you wouldn't be able to complete it either.
– Basil
Jan 14 '18 at 12:04
I actually want to change the selected answer to myself after doing a lot more research. The given answer above is close, but not quite. It highlights the entire line which I don't want (for example it won't highlight the (circle 10)
inside (visalign (circle 10) (circle 20))
.
For this, I ended up using this package:
dotspacemacs-additional-packages '(
(highlight-sexp :location (recipe :fetcher github :repo "daimrod/highlight-sexp"))
)
And my config in user-config
:
(setq hl-sexp-foreground-color nil)
(setq hl-sexp-background-color "#333")
If that doesn't work for you, I found various sexp
highlight packages. They're all slightly different. For example one includes the parens, another doesn't. But for the most part they all do the same thing.
show-paren-mode
with show-paren-style
set to 'expression
works fine for me, e.g. (circle 10)
is also highlighted.
– Basil
Jan 14 '18 at 12:08