I'm very new to Emacs, and I'm having trouble finding information about electric-layout-mode
, specifically electric-layout-rules
.
I use c-toggle-auto-newline
right now, but I'm trying to replace this with Electric Layout in the hopes that it will cooperate with Electric Pair Mode, so that I can combine the autoindentation of electric-indent-mode
with Electric Pair Mode's bracket behavior.
In other words, I am hoping it will give me this behavior upon pressing "{":
int main() <- (Ideally autonewline here, as C Auto Newline does)
{
(point)
}
However, I can't find enough information about electric-layout-rules
to get it working in my .emacs file. I enabled electric-layout-mode
without trouble, since there is an entry for it in the Customize buffer.
I looked at the Help entry for "electric-layout-rules", but I had trouble understanding it, and I noted that the syntax for it was similar to that of c-hanging-braces-alist
of C Auto Newline, which I tried in vain to emulate the syntax of.
Long story short, I would appreciate some kind of use example for electric-layout-rules
, something I might be able to put into my .emacs file.
EDIT: I had asked a similar, less detailed version of this question on SuperUser a couple of weeks ago. I don't know how to get questions moved, but I figured I might leave it open until this one is answered or if someone suggests that I delete it now, in case any of it is relevant here.
This Electric Layout Mode Manual Page was linked to in the other question, but I doesn't have anything on customizing the behavior through electric-layout-rules
, and it explicitly says JavaScript on it. The code in the answer and electric-layout-mode
didn't work when editing a C file.