Skip to content
tom tan edited this page Aug 26, 2013 · 10 revisions

Install DMD

DMD is a reference implementation of D compiler. You can get it from dlang.org.

(Optional) Setup exec-path for Emacs

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 MELPA repository for package.el

Add the following lines to your .emacs.

(require 'package)
(add-to-list 'package-archives
 '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)

Install d-mode.el

You can install it by using M-x package-install d-mode.

Install Flycheck

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)

Small setup for Flycheck.

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))

Finish!

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.

Clone this wiki locally