defunkt/coffee-mode — Issue #68: Setting tabs to two spaces breaks auto-indentation
Author: duncan-bayne
Created: 2012-02-05 12:44:15+00:00
State: open

If I add the following code to my .emacs file:

(defun coffee-custom ()
"coffee-mode-hook"
(set (make-local-variable 'tab-width) 2))
(add-hook 'coffee-mode-hook
'(lambda() (coffee-custom)))

... then I get tabs inserted as two spaces, which is correct. However, this breaks auto-indentation.

I then create a new .coffee file and type in a class without using the TAB key (i.e. just relying on auto-indentation). Note how, with tabs set to two spaces, auto-indentation doesn't indent the body of the bar function:

class Foo
bar: (baz) ->
qux()

If I remove the above snippet from my .emacs file and try again, the body of the bar function is indented automatically:

class Foo
bar: (baz) ->
qux()