Giter Site home page Giter Site logo

Comments (7)

rrthomas avatar rrthomas commented on July 28, 2024 1

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.

jscheid avatar jscheid commented on July 28, 2024

@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.

jscheid avatar jscheid commented on July 28, 2024

I might see if I can make time to improve this.

from dtrt-indent.

rrthomas avatar rrthomas commented on July 28, 2024

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.

fleutot avatar fleutot commented on July 28, 2024

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.

rrthomas avatar rrthomas commented on July 28, 2024

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.

fleutot avatar fleutot commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.