Using a custom beginning of line function instead of auto-indent-mode

Fixes Python issues