www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ide - emacs packages

reply glis-glis <andreas.fueglistaler gmail.com> writes:
Is there any documentation on how to use emacs with D? The github 
page of emacs d-mode [1] does not really explain a lot, nor does 
the wiki-page [2].

At the moment, I use the following packages: d-mode, 
flycheck-d-unittest and company-dcd. I really like the way 
unittests are underlined when failing by flycheck, giving an 
almost REPL-like programming experience.

Autocompletion with company-dcd and syntax check with flycheck 
mostly work fine, but they are not able to find my packages 
installed with DUB. Also, company-dcd-goto-definition only works 
for the standard-library, it is not able to find the definition 
of my own functions nor packages I installed with DUB.

Is there a dfmt-package for emacs? I still use clang-format, 
which kind of works for D-code except when the syntax does not 
exist in C++ (for example "=>" ).

[1] https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode
[2] https://wiki.dlang.org/Editors
Feb 08
next sibling parent reply glis-glis <andreas.fueglistaler gmail.com> writes:
On Monday, 8 February 2021 at 09:10:26 UTC, glis-glis wrote:
 Is there any documentation on how to use emacs with D? The 
 github page of emacs d-mode [1] does not really explain a lot, 
 nor does the wiki-page [2].

 [...]
Given the absence on replies, I see two possibilities: (1) I'm the only emacs-user or (2) All emacs-users encounter the same problems I do
Feb 18
parent Preetpal <preetpal.sohal gmail.com> writes:
On Thursday, 18 February 2021 at 15:29:51 UTC, glis-glis wrote:
 On Monday, 8 February 2021 at 09:10:26 UTC, glis-glis wrote:
 Is there any documentation on how to use emacs with D? The 
 github page of emacs d-mode [1] does not really explain a lot, 
 nor does the wiki-page [2].

 [...]
Given the absence on replies, I see two possibilities: (1) I'm the only emacs-user or (2) All emacs-users encounter the same problems I do
I also use Emacs with D but I just use syntax highlighting at the moment. You might want to try a language server protocol server for D like https://github.com/pure-d/serve-d. I have not used it myself, but I have used something similar with TypeScript in the past successfully in Emacs.
Feb 19
prev sibling next sibling parent mori <stigma disroot.org> writes:
On Monday, 8 February 2021 at 09:10:26 UTC, glis-glis wrote:
 Autocompletion with company-dcd and syntax check with flycheck 
 mostly work fine, but they
 are not able to find my packages installed with DUB. Also, 
 company-dcd-goto-definition
 only works for the standard-library, it is not able to find the 
 definition of my own
 functions nor packages I installed with DUB.
Unfortunately, I can't help here as I only use d-mode for syntax highlighting.
 Is there a dfmt-package for emacs? I still use clang-format, 
 which kind of works for D-code except when the syntax does not 
 exist in C++ (for example "=>" ).
I haven't used clang-format nor do I know if there is a dfmt package, but you could define a function that runs "dfmt" on the current file. I can share a basic implementation if you need. You could also take a look at [uncrustify] which has support for D, though I haven't used it. There even seem to be some (old, but hopefully working,) modes for it: - https://github.com/glima/Emacs-uncrustify - https://github.com/koko1000ban/emacs-uncrustify-mode [uncrustify]: http://uncrustify.sourceforge.net/
Feb 19
prev sibling parent Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Monday, 8 February 2021 at 09:10:26 UTC, glis-glis wrote:
 Is there any documentation on how to use emacs with D?
Well, that depends entirely on how you use D, and how you use Emacs. :)
 Autocompletion with company-dcd and syntax check with flycheck 
 mostly work fine, but they are not able to find my packages 
 installed with DUB.
For this, you probably want the flycheck-dmd-dub package: https://github.com/atilaneves/flycheck-dmd-dub
 Also, company-dcd-goto-definition only works for the 
 standard-library, it is not able to find the definition of my 
 own functions nor packages I installed with DUB.
company-dcd actually uses flycheck-dmd-dub to query Dub import paths and pass them on to DCD, so it should work (though perhaps something needs to be turned on or otherwise configured first).
 Is there a dfmt-package for emacs? I still use clang-format, 
 which kind of works for D-code except when the syntax does not 
 exist in C++ (for example "=>" ).
For indentation, you can use cc-mode's facilities, which are supported in d-mode via indent-region. For full-on formatting, Per Nordlöw wrote a dfmt package (wrapping the titular tool). A copy can be found here: https://github.com/qsimpleq/elisp-dfmt
Feb 19