Shouldn't you locally set `electric-indent-inhibit` (to t) or `electric-indent-chars` (to nil), instead?