I have set lime as a background color for my region, and I also have enabled to highlight matching parens using (show-paren-mode 1).

The issue I have is that when I exactly select the contents between two parens, the light grey background color of the parens ( and ) overlays the region background color, which can look quite confusing:

enter image description here

In the above screenshot I selected everything from the first ( to the last ), including these characters.

I would prefer if everything has the lime region background, including the parens. But when no region is active, then I want the matching parens to be highlighted in light grey.

Is there a way to do this?


2 Answers 2


Try adjusting downward the value for show-paren-priority -- "[p]riority of paren highlighting overlays" -- which has a default value of 1000. The priority for the active region is '(nil . 100), which is hard-coded in redisplay-highlight-region-function.



This property's value determines the priority of the overlay. If you want to
specify a priority value, use either nil (or zero), or a positive integer. Any
other value has undefined behavior.

The priority matters when two or more overlays cover the same character and both
specify the same property; the one whose priority value is larger overrides the
other. (For the face property, the higher priority overlay's value does not
completely override the other value; instead, its face attributes override the
face attributes of the lower priority face property.) If two overlays have the
same priority value, and one is nested in the other, then the inner one will
prevail over the outer one. If neither is nested in the other then you should
not make assumptions about which overlay will prevail.

Currently, all overlays take priority over text properties.

Note that Emacs sometimes uses non-numeric priority values for some of its
internal overlays, so do not try to do arithmetic on the priority of an overlay
(unless it is one that you created). In particular, the overlay used for showing
the region uses a priority value of the form (primary . secondary), where the
primary value is used as described above, and secondary is the fallback value
used when primary and the nesting considerations fail to resolve the precedence
between overlays. However, you are advised not to design Lisp programs based on
this implementation detail; if you need to put overlays in priority order, use
the sorted argument of overlays-at. See Finding Overlays.

It seems likely that your face show-paren-match has :background set to a dark grey color. Try running this:

(set-face-attribute 'show-paren-match nil :background nil)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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