-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indentation with tabs does not work correctly #85
Comments
This is a known limitation of the indentation code. I would have thought the change happened in eae8137, though. I should add this to the README, but for now if you want tabs you can revert to the native As always, PRs welcome. I don't use tabs myself, so this is unlikely to get fixed soon. (Since I'm not familiar with how That said, if anyone's interested, I would start by removing this binding and seeing what happened. It might be that that alone is enough. Otherwise, I'd look into |
Ahhh, yeah, I wasnt 100% sure on the timing because at my job we use spaces and at home I prefer tabs (its a constant internal struggle). At any rate, I will try the workaround. I wish I could quickly submit a PR, but unfortunately elisp is very alien to me so it will take some getting up to speed. |
A workaround alternative to what README suggests: (add-hook 'rjsx-mode-hook
(lambda ()
(add-hook 'before-save-hook
(lambda ()
(if indent-tabs-mode
(tabify (point-min) (point-max))
(untabify (point-min) (point-max))
))
nil
t))) |
So I had been using this for quite a while, but after the update to Emacs 27, this work around no longer works because of mooz/js2-mode#529. I tried to see if I could create a new major mode locally that derived from So unfortunately, not a great solution now for tabs.
Right now I am doing the second. I tried to modify |
@matthemsteger So what happens if you just remove that Like thornjad@e0a06a6 does. |
@dgutov I did try that, unless I messed it up, it did not work. That being said, I had not realized |
I tried to remove the |
That's what indentation with tabs in Emacs does. To avoid it, make sure all offsets are multiples of the tab width. Did you expect some other behavior? |
I guess it is due to #106 then. |
Just as a followup, I usually use spaces but have been working on a project where tabs are used and so needed this. I tracked down the binding change that @felipeochoa suggested and it has been working for me so far. Just saw this issue and wanted to give feedback. Thanks for rjsx-mode. It's been very helpful! |
After the fix in 68fe4c0 it looks like tabs are replaced by (the appropriate number of) spaces. I can dig a little further, but this appeared after this fix (which I am thankful for, it made writing JSX very difficult).
Switching to js2-mode makes things work appropriately.
Various indentation variables (I use editorconfig-emacs to set these)
js2-basic-offset
: 4js-indent-level
: 4sgml-basic-offset
: 4indent-tabs-mode
: tThe text was updated successfully, but these errors were encountered: