Bozhidar Batsov is blogging up a storm on his new Emacs Redux blog. The other day, he mentioned a couple of useful modes that, since Emacs 24.1, are built in. The first is electric-pair-mode. It provides the automatic pairing of special delimiters such as “, (, [, and {. Much like paredit
, when you type the left character of the pair, the right character is also inserted and the point is placed between them. Typing the right character merely skips over the already inserted right character rather than inserting a new one. You can insert just a single character by preceding it with the quote sequence 【Ctrl+q】.
I didn’t realize this was a built-in and have been meaning to install the package. It was a nice surprise to learn that all I needed to do was enable it.
The second electric mode is electric-indent-mode. It’s purpose is to automatically indent the next line after you type certain characters such as a newline. I already have 【Return】 mapped to newline-and-indnet
so this is less useful to me and I haven’t enabled it. You may find it useful, though. Be aware that it reportedly causes problems with Python mode so be alert.