defunkt / coffee-mode

Emacs Major Mode for CoffeeScript
http://ozmm.org/posts/coffee_mode.html
574 stars 147 forks source link

Coffee-mode, indents keeps doubling #369

Open quangv opened 6 years ago

quangv commented 6 years ago

Description :octocat:

I am editing a coffee-script file, so am using coffee-mode

The indents keeps doubling... so 4, 8, 16, 32 .... the further I nest...

https://emacs.stackexchange.com/questions/41072/spacemacs-coffee-mode-indents-keeps-doubling?noredirect=1#comment64517_41072

Thanks!

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

The indents keeps doubling.

what happens

Expected behaviour: :heart: :smile:
enter image description here

Only indent 2 spaces per level.

System Info :computer:

Backtrace :paw_prints:

<<BACKTRACE IF RELEVANT>>                                                                           

mirror of: https://github.com/syl20bnr/spacemacs/issues/10602

Compro-Prasad commented 5 years ago

I don't think this is being actively maintained.

gfederix commented 5 years ago

It is probably spacemacs fuck up!

My patch:

diff --git a/coffee-mode.el b/coffee-mode.el
index a2ce3fa..6998d2a 100644
--- a/coffee-mode.el
+++ b/coffee-mode.el
@@ -892,6 +892,10 @@ END lie."
                   (coffee-indent-shift-amount start end 'right))))
     (indent-rigidly start end amount)))

+(defun indent-for-tab-command ()
+  (interactive
+   (call-interactively 'coffee-indent-shift-right)))
+
 (defun coffee-indent-region (start end)
   (interactive "r")
   (save-excursion

Activate indent-tabs-mode if you use coffe-indent-tabs-mode