2014-09-27 show-paren-mode

For today, I only have a short tip. Sorry;-).

I guess many Emacs users know about show-paren-mode, which highlights the closing paren (or brace, or bracket…) when the point is on the opening one (or the opening one when the point is right after the closing one). BTW, one of the annoyances of show-paren-mode is that in this situation:

{abc}|{xyz}

(the pipe symbol means the point), the closing brace after xyz is not highlighted (the opening one before abc is). Its a bit of a PITA for TeX users - yet another reason I’ll have to do some work on Emacs’ AUCTeX mode (though I’m not sure how to resolve this one). Some day.

OTOH, what is nice (and maybe less known) about show-paren-mode is its behavior when the matching paren is not visible. By default, nothing happens then, which is not that helpful. There is, however, a variable called show-paren-style, and setting it to 'mixed causes Emacs to highlight the matching paren if it’s visible and the whole visible part of the expression in parens when it’s not. Cool.

To sum it up, this is what I have in my init.el:

(setq show-paren-style 'mixed)
(show-paren-mode)

(Note that show-paren-mode is one of the rare examples of a global minor mode, so this turns it on basically everywhere.)

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryTeX