-
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
Adapting tab mode to file content not working #59
Comments
@fleutot set @rrthomas when The diagnosis should say something like "dtrt-indent doesn't run in this buffer because...". As for the minor mode, I haven't been involved with its refactoring: do you think it would be better to check inside the globalized mode to decide whether or not it should be enabled for a given buffer? |
I might see if I can make time to improve this. |
And thank you @jscheid and @rrthomas for looking into this :) If any of you wants to earn free internet pointz, here is the question I wrote on StackExchange about this. Incidentally, and this is a little embarrassing, I didn't load the package correctly in my minimal example above either:
I did create a custom prog mode hook, but never actually loaded it. How silly. This works:
I kind of expected dtrt to replace smie altoghether. But now it looks like it rather requires it? I suppose there is a use for |
As far as the interaction with SMIE goes (since I introduced that) the idea is that for modes that use SMIE, dtrt-indent should defer to SMIE. If you don't use |
I don't understand "defer to SMIE". Do you mean that dtrt-mode does nothing by default if SMIE is in use? Even if dtrt-mode is active? And If that is the case, I understand @jscheid's comment better, it really is confusing having the mode active but no effect. Why not have |
That's right.
Indeed, if you're activating |
The documentation made me expect
dtrt-indent
to adaptindent-tabs-mode
to "the right thing":However, opening this file
/tmp/asdf.sh
with basic init file~/tmp/basic-init.el
does not seem to guess and modify to the right value ofindent-tabs-mode
.Test material
/tmp/asdf.sh
:basic-init.el
:Test result
Starting emacs with

emacs -q -l ~/tmp/basic-init.el /tmp/asdf.sh
, then activating whitespace mode withC-c b
gives me this:After going to the row with 8 space indent (

wefwefew
), deleting one space, pressing TAB, I get this:Expected result:
dtrt-indent-mode
indents with spaces, since all other indentations are with spaces.Debug data
Here is what I have found so far.
Result of
dtrt-indent-diagnosis
:It seems
dtrt-indent-mode
could correctly guess thatindent-tab-setting
(although there is no such variable? Is there? Wrong name? Shouldn't it beindent-tabs-mode
?) should be nil.But it could only hint the user that they probably want to set it to nil (the message seems to be a recommendation, although it is not obvious. At first glance, it looks like dtrt-indent actually made the change).
C-h v
indent-tabs-mode
ist
, so it was not changed. According to the code comment I posted at the top, it should?The embedded help I open from that emacs session says:
package-list-packages
tells me that what I have installed is this:The text was updated successfully, but these errors were encountered: