Last update August 18, 2012

Editor Support /
Emacs Editor



Difference (last change) (no other diffs, normal page display)

Changed: 1c1
Option 1: EmacsDMode? is the latest D-mode for Emacs. It is a rewrite of D-mode from scratch. Put it into your emacs site-lisp directory and follow the instructions in the d-mode.el file to compile the file and add the proper auto-load setup to your .emacs file. This version requires a recent cc-mode (>5.30), so if you're using an earlier version of cc-mode, it's time to upgrade. The new cc-mode is all around much better. See also DProgrammingLanguage page at EmacsWiki.
== d-mode for Emacs ==

Changed: 3c3
Option 2: For D support on Emacs 21.x only is Ben Hinkle's mode. The zip file d-mode.zip contains both d-mode and a few other tools that may or may not work on newer versions of emacs.
The currently maintained version of the d-mode, compatible with Emacs 23 and Emacs 24, can be found at its development page at Github.

Changed: 5c5
Note: Ben's version above does not work on versions of Emacs greater than 21.x. I've tried on 22.0.something and on a cvs checkout (23.0.0, emacs-unicode-2 branch), and the d-mode command caused the same errors on both. It seems like there might be some sort of api mismatch or something, but that's just a guess. -- <n>MichaelA?</n> September 20, 2006
This is the d-mode written from scratch by Bill Baxter and currently maintained by a small team of contributors.

Changed: 7c7
Option 3: If that doesn't work for you then you can try java-mode. That seems to do a pretty decent job on D code. It's better than c++-mode, at least. Newer versions of emacs may have a csharp-mode too.
== Support for older Emacsen ==

Changed: 9,10c9,11
Sort of an Option 3, but not really: For emacs 22.x, if you Google you may find another d-mode.el by Sam Steingold. This is not a d-mode for the D Programming Langauge, but a d-mode for some sort of C-like extension language for CLISP:
CLISP's d-mode (Here's an example of that other D code if you're curious). The funny thing is that this actually does a reasonable job formatting and highlighting DigitalMars D code. I was using it happily for weeks before I realized it was a mode for the wrong D.
For D support on Emacs 21.x only is Ben Hinkle's mode. The zip file d-mode.zip contains both d-mode and a few other tools that may or may not work on newer versions of Emacs.

If that doesn't work for you then you can try java-mode. That seems to do a pretty decent job on D code. It's better than c++-mode, at least. Newer versions of emacs may have a csharp-mode too.

Changed: 12,15c13,14
=== <n>History</n> ===
* Updated Dec 7, 2003 by Ben Hinkle ( NG:D/19993).
* Updated Feb 24, 2007 by Bill Baxter
* Updated Mar 2, 2007 by Bill Baxter
For emacs 22.x, if you Google you may find another d-mode.el by Sam Steingold. This is not a d-mode for the D Programming Langauge, but a d-mode for some sort of C-like extension language for CLISP:
CLISP's d-mode (Here's an example of that other D code if you're curious). The funny thing is that this actually does a reasonable job formatting and highlighting DigitalMars D code. I was using it happily for weeks before I realized it was a mode for the wrong D.

Changed: 17,18c16
===Emacs 22 for Win32=
A note for windows Emacs users -- you can get a more recent version of emacs for Windows than the FSF's 21.x from the EmacsW32 project. But word I hear is that Emacs 22 will be release "Officially" before too long, then you'll be able to find it for Windows from the FSF emacs site. Apparently it's not too difficult to build from sources either.
== Support for Compilation (M-x compile) ==

Deleted: 20d17
===Support for Compilation (M-x compile)=

Added: 34a32


Changed: 59c57,58
===Support for flymake =
== Support for flymake ==


Changed: 69c68
Change the d-mode-hook to something else if you're not in d-mode while editing .d -files.
Change the d-mode-hook to something else if you're not in d-mode while editing .d -files.

d-mode for Emacs

The currently maintained version of the d-mode, compatible with Emacs 23 and Emacs 24, can be found at its development page at Github.

This is the d-mode written from scratch by Bill Baxter and currently maintained by a small team of contributors.

Support for older Emacsen

For D support on Emacs 21.x only is Ben Hinkle's mode. The zip file d-mode.zip contains both d-mode and a few other tools that may or may not work on newer versions of Emacs.

If that doesn't work for you then you can try java-mode. That seems to do a pretty decent job on D code. It's better than c++-mode, at least. Newer versions of emacs may have a csharp-mode too.

For emacs 22.x, if you Google you may find another d-mode.el by Sam Steingold. This is not a d-mode for the D Programming Langauge, but a d-mode for some sort of C-like extension language for CLISP: CLISP's d-mode (Here's an example of that other D code if you're curious). The funny thing is that this actually does a reasonable job formatting and highlighting DigitalMars D code. I was using it happily for weeks before I realized it was a mode for the wrong D.

Support for Compilation (M-x compile)

Many of DMD's compilation error messages lack a category prefix (like "Error" or "Warning"). Without the category, the messages don't match Emacs' built-in error matching regexps used for M-x next-error after a M-x compile. That makes M-x compile unable to take you to the the file and line where the error is.

Add this to your .emacs and it should fix it.

(require 'compile)
(add-to-list
 'compilation-error-regexp-alist
 '("^\\([^ \n]+\\)(\\([0-9]+\\)): \\(?:error\\|.\\|warnin\\(g\\)\\|remar\\(k\\)\\)"
   1 2 nil (3 . 4)))

Also (this is Windows-specific) but if you don't have your DMD stuff always added to your path by default, you can add it in your .emacs. I always have an environment variable set called "DMDDIR" that points to where DMD is installed. Then I add this to my .emacs (uncomment the INCLUDE part if you have some default includes you want to add):

; modify executable path to include DMD stuff
(setq exec-path (cons "C:/dmd/bin" exec-path))
; Or this more tricky version that uses a DMDDIR environment variable
;(setq exec-path (cons 
;		 (concat (replace-regexp-in-string "\\\\" "/" (getenv "DMDDIR")) "/dmd/bin")
;		 exec-path))
(let ((DMDDIR (getenv "DMDDIR")))
  (setenv "PATH" 
	  (concat DMDDIR "\\dmd\\bin;" 
		  DMDDIR "\\dm\\bin;" 
		  DMDDIR "\\dsss\\bin;"
		  (getenv "PATH") ))
  (setenv "LIB" 
	  (concat DMDDIR "\\dmd\\lib;" 
		  DMDDIR "\\dm\\lib;" 
		  (getenv "LIB") ))
;  (setenv "INCLUDE" 
;	  (concat DMDDIR "\\dmd\\lib;" 
;		  DMDDIR "\\dm\\lib;" 
;		  (getenv "INCLUDE") ))
  )

Support for flymake

Flymake-mode is a mode for emacs which compiles edited files in the background and highlights possible errors. Here is a version modified to support dsss building.

(Note: the link above is currently broken. I've added a Flymake configuration example to the EmacsWiki?. -- GrahamFawcett?)

If you want to automatically enable flymake when editing .d files just add following somewhere where emacs can find it (.emacs):

(add-hook 'd-mode-hook 'flymake-mode)

Change the d-mode-hook to something else if you're not in d-mode while editing .d -files.


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: August 18, 2012 18:39 (diff))