moved ruby's electric indent to lua-mode - #112
Conversation
now, when typing a closing token like _end_, an automatically reindent will be performed. it also works for _else_ _elseif_ _until_ function foo() ... en end<- in the above example, typing 'd' will invoke the automatically reindent
immerrr
commented
Dec 10, 2015
Hi and thank you for the PR. Electric indentation of block closing tokens is already implemented via If you don't mind doing some refactoring to select the one that is appropriate for the running version of emacs on top of your slightly adapted copy-n-paste, I'll gladly accept that. |
ngzh
commented
Dec 10, 2015
Thanks for your quick reply. I'm using emacs 24.5 actually, so I guess there may be some surprise for me since electric indent doesn't work for me out of the box(I've tried toggle lua-toggle-electric-state but didn't see any difference) And as for the code I copied, I'll try to make them clean to provide those who need a fallback. Got to learn something but that will be OK, just need some time. |
immerrr
commented
Dec 10, 2015
@fangzhouuu you might need to enable |
ngzh
commented
Dec 11, 2015
Well I've enable abbrev-mode but it still not working for |
immerrr
commented
Dec 11, 2015
You can do If you have cask, you can use |
immerrr
commented
Dec 11, 2015
Also, there are tests for electric indentation functionality: lua-mode/test/test-electric-mode.el Lines 35 to 71 in 0b41d44 |
Copied from ruby-mode.el
now, when typing a closing token like end, an automatically reindent
will be performed. it also works for elseelseifuntil. (I did a quick
scan on lua syntax, described in lua manual and don't think there will be
more keyword which trigger a reindent)
example:
I'm been using this for almost a month and everything seems to be ok, though in fact I'm not very familiar with elisp, so better have a look at the code and do some extra test.