-
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
Overriding tab setting for hard tabbed file #46
Comments
I'm sorry that despite being the current maintainer I don't know the code well enough to give a comprehensive answer. I observe that I wonder whether this is a matter of the order in which things happen when |
I think tab-width is a red-herring here. I should be using c-basic-offset.
|
It looks like the processing that dtrt-indent is doing in define-minor-mode is too early, and probably should be done on a hook, maybe hack-local-variables-hook? Not sure. |
I pushed a commit to my fork for you to look at that does fix the problem of overriding the variables by using hack-local-variables-hook to delay the initial dtrt-indent setup until the file local variables have been set. It doesn't do exactly what I want, as I really want dtrt-indent to set all related variables, but I guess I can make do without that. |
I added some functionality to allow overriding the offset found without disabling any of the setting of related variables. Also added code to allow the related variables to apply to any derived major mode. I'll test these this week. Let me know if these seem reasonable or not. |
Thanks, this all looks good. Let me know how you get on with testing! |
Updated the code, moved to branch tab-override in my fork. Still trying it out. Fixed the explicit file variable setting of indent-tabs-mode as well, as it didn't work. |
Any update on this? |
No not really. I wasn't able to get it work correctly in all cases. I think it's probably doable, but I don't know enough about emacs internals to do it. |
OK, thanks for getting back to me! I guess it's worth leaving this issue open in case anyone with enough time and/or expertise can solve it in future. |
Yes please. I may revisit the problem again as well. |
I have a source tree which uses hard tabs for indentation and which assumes tab width is a value different than my default tab-width (as set up in init.el). I'd like to tell dtrt-indent via .dir-locals.el to set that tab-width and let it set any related variables (e.g. evil-shift-width). I've failed so far to do this.
If I set tab-width in .dir-locals.el, that sets only tab-width, dtrt-indent seems to use my default values for everything else.I get the same result by setting c-basic-offset.
Here is the messages I get for dtrt-indent in both cases (I am trying to set tab width to 3 via .dir-locals.el, my init.el sets tab-width and evil-shift-width to 4, I don't set c-basic-offset at all):
Is there a way to do this?
Here is my setup for dtrt-indent:
The text was updated successfully, but these errors were encountered: