When you want to use awesome paredit with erlang-mode or any other non-lisp language there's a problem when you want to insert a pair of parenthesis for a function call.
Say you have typed myFunction
and now type (
, paredit assumes you're in a lisp and creates myFunction ()
instead of myFunction()
.
The snippet prevents paredit from inserting a space before parentheses by locally resetting the predicate functions used to determine if a space should be inserted before a pair of parentheses. By changing the hook used you could also make this work in any other mode for non-lisp languages. For exampe for js2-mode
replace erlang-mode-hook
in line 1 with js2-mode-hook
.