-
Notifications
You must be signed in to change notification settings - Fork 4
Start D with Emacs
DMD is a reference implementation of D compiler. You can get it from dlang.org.
If you do not install DMD in PATH
, add the following line to your .emacs
(please modify "/path/to/dmd" to fit your environment).
(add-to-list 'exec-path (expand-file-name "/path/to/dmd"))
Add the following lines to your .emacs
.
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
You can install it by using M-x package-install d-mode
.
You can install it by using M-x package-install flycheck
.
After installing Flycheck, Emacs has on-the-fly D syntax checker.
(Optional) Install flycheck-d-unittest.el
If you want to run unittest on-the-fly, you can use flycheck-d-unittest.
You can install it by using M-x package-install flycheck-d-unittest
and add the following line to your .emacs
.
(setup-flycheck-d-unittest)
For your convenience, add the following lines to your .emacs
.
(add-hook 'd-mode-hook
(lambda ()
(local-set-key (kbd "C-c C-p") 'flycheck-previous-error)
(local-set-key (kbd "C-c C-n") 'flycheck-next-error)))
Have fun!
You can see the error lines highlighted in D source code.
You can use C-c C-p
and C-c C-n
to go to previous and next errors, respectively.