Comments (7)
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
dtrt-indent-run-after-smie
overrides that and makes it run anyway?
That's right.
Why not have
dtrt-indent-run-after-smie
on by default? Whoever activates the mode (at least locally) certainly wants it active?
Indeed, if you're activating dtrt-indent-mode
locally, then it may make sense to turn dtrt-indent-run-after-smie
on. The default setting of off makes sense when you're just using dtrt-indent-global-mode
. The idea is that SMIE is supposed to solve the same problem, and it's the "default" solution, so we don't want to interfere with it by default.
from dtrt-indent.
@fleutot set dtrt-indent-run-after-smie
and it should work.
@rrthomas when dtrt-indent
doesn't run because SMIE is active (and dtrt-indent-run-after-smie
is nil) there is no indication to users: dtrt-indent-diagnosis
doesn't mention it, the mode-line lighter is displayed, and the minor mode is listed as active. This is clearly confusing.
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?
from dtrt-indent.
I might see if I can make time to improve this.
from dtrt-indent.
Thanks very much, @jscheid, for looking into this and other issues; also thanks @fleutot for a beautifully detailed report for this issue.
from dtrt-indent.
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:
(use-package dtrt-indent
:ensure t
:config (dtrt-indent-mode t)) ; This line is NOT going to load the module by itself
I did create a custom prog mode hook, but never actually loaded it. How silly.
This works:
(defun my-prog-mode-hook ()
(dtrt-indent-mode))
(add-hook 'prog-mode-hook 'my-prog-mode-hook)
(use-package dtrt-indent
:ensure t
:config
(setq dtrt-indent-run-after-smie t)
)
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 dtrt-indent-mode
without dtrt-indent-run-after-smie
, but I don't see what it could be? If there isn't, why not make it default?
from dtrt-indent.
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 dtrt-indent-run-after-smie
, then dtrt-indent
will still be used in non-SMIE modes.
from dtrt-indent.
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 dtrt-indent-run-after-smie
overrides that and makes it run anyway?
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 dtrt-indent-run-after-smie
on by default? Whoever activates the mode (at least locally) certainly wants it active?
from dtrt-indent.
Related Issues (20)
- Wrong indentation in shell-mode HOT 4
- 1/253 relevant lines HOT 5
- dtrt-indent-try-set-offset doesn't set generic indent variables HOT 1
- check adjacent-files like vim-sleuth HOT 2
- Advice is active regardless of whether the mode is active HOT 5
- Overriding tab setting for hard tabbed file HOT 11
- do nothing when editor-config is activated HOT 4
- Issue with protobuf-mode HOT 3
- Delay for running dtrt-indent HOT 5
- Add guess-style to related work section of readme
- Support for different js-mode offset variables HOT 5
- How to install this? HOT 3
- Feature request: Infer additional variable in web-mode
- web-mode support doesn't work well for heterogeneous indent types HOT 4
- Improve analysis of files with consistent indentation where offset is guessed wrongly due to merging HOT 2
- Error while processing typescript files HOT 3
- Guess indentation for new files in a project HOT 3
- Support `typescript-ts-base-mode` and thus `tsx-ts-mode`? HOT 1
- Compilation warnings under Emacs 29.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dtrt-indent.