I use M-x align-regexp
in emacs to prettify my Perl code, but by default it is using tabs instead of spaces, which is something one should not do according to Perl critic.
Is there a way to change the behaviour of align-regexp
so that it fills in with the right amount of spaces instead of tabs?
In general you should avoid using advice, but since
align.el
directly reads the value ofindent-tabs-mode
, it's probably the best way:Here was my original version:
As @Phils pointed out, this is unnecessarily complex and less fool proof, so use the code at the top of the post.