Giter Site home page Giter Site logo

Comments (9)

CyberShadow avatar CyberShadow commented on May 30, 2024 1

Yes, please submit a pull request.

If you could include a test that covers all of the offset settings, that would be great.

from emacs-d-mode.

nordlow avatar nordlow commented on May 30, 2024

Incorrect indentation still happens for me. Can you point to a place in d-mode.el that controls this behaviour?

from emacs-d-mode.

CyberShadow avatar CyberShadow commented on May 30, 2024

Incorrect indentation still happens for me.

Please don't forget to configure the offset according to your preference. (C-c C-o)

Can you point to a place in d-mode.el that controls this behaviour?

Please see d-in-knr-argdecl.

from emacs-d-mode.

nordlow avatar nordlow commented on May 30, 2024

Please see d-in-knr-argdecl.

Thanks! Would it be possible to have

(c-set-offset 'knr-argdecl-intro 0)

be called automatically upon entering of d-mode, provided d-mode.el has been loaded?

I now currently have

(c-add-style "D"
             '("stroustrup"
               (c-offsets-alist
                (innamespace . -)
                (inline-open . 0)
                (inher-cont . c-lineup-multi-inher)
                (template-args-cont . +)
                (substatement-open . 0)
                (statement-block-intro . +)
                (arglist-cont-nonempty (d-lineup-cascaded-calls
                                        c-lineup-gcc-asm-reg
                                        c-lineup-arglist))
                (statement-cont . d-lineup-cascaded-calls)
                (case-label . 0)        ;no indentation
                (knr-argdecl-intro . 0) ;no indentation for template restrictions and in contracts
                )))

which I believe matches the recommend D formatting rules.

What about adding this to d-mode.el?

from emacs-d-mode.

CyberShadow avatar CyberShadow commented on May 30, 2024

I think the proper way is something like:

(c-add-style
 "My D style"
 '((c-offsets-alist . ((knr-argdecl-intro . 0)
                       ;; ...
		       ))))

(defun my/d-mode-hook ()
  (c-set-style "My D style"))
(add-hook 'd-mode-hook 'my/d-mode-hook)

from emacs-d-mode.

CyberShadow avatar CyberShadow commented on May 30, 2024

What about adding this to d-mode.el?

Sounds good. It should mention that it attempts to implement https://dlang.org/dstyle.html as closely as possible.

from emacs-d-mode.

nordlow avatar nordlow commented on May 30, 2024

What about adding this to d-mode.el?

Sounds good. It should mention that it attempts to implement https://dlang.org/dstyle.html as closely as possible.

Do you want to add it or shall I?

from emacs-d-mode.

nordlow avatar nordlow commented on May 30, 2024

I believe the setting should be activated by default.

from emacs-d-mode.

CyberShadow avatar CyberShadow commented on May 30, 2024

Not by default I think (unless that's common practice for cc-mode-based major modes? but even then I'm not sure about changing the current default), but we can document how to enable it in the README.

from emacs-d-mode.

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.