So I've switched to Emacs Prelude, and like it; it comes with 95% of the stuff I want baked-in, and that's lovely. Only one thing I want to change: mode-specific indent between parens, a la autopair.el
. For instance, if I'm writing Scala and type:
Object foo {
bar() {}
}
... and enter a newline between the curly braces of bar
, I should get:
Object foo {
bar() {
// And point should be here, a Scala-standard two-space indent in from bar.
}
}
But, if I were writing more or less the same thing in PHP, I should get a tab
character instead of a two-space tab.
So: is there a "right" way to tweak this through custom.el
? Prelude uses smartparens
instead of autopair.el
, configured in prelude-editor.el
-- but I'd rather get this configured without having to hack "core" Prelude so that I can merge in updates easily.
Thoughts? Anybody else figured out how to do this with smartparens
at all, or Prelude in particular?
You're already on the right track. I'll just add a bit to your self-posted answer.
The general idea with smartparens is to develop specialized configs for different major modes, so you can have the best experience for each of them. History has taught us that generic solutions generally are suboptimal.
smartparens users are encouraged to submit upstream config for various major modes - there are already configs for Ruby, Latex, Lisp and Lua. You might do well to submit upstream configs for Scala and PHP for the benefit of all smartparens users. Prelude will enable those out of the box when present.
The ability to fine tune just about everything made me pick smartparens for Prelude. I think that smartparens will become more important for Emacs users in the future (it's already managed to displace behemoths like paredit for Lisp programming).