# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 54385 2009-07-26 10:14:39Z billitch@macports.org $

PortSystem              1.0

name                    d-mode.el
version                 2.0.4
categories              lang editors
maintainers             billitch
description             D Programming Language mode for (X)Emacs

long_description        This mode supports most of D's syntax, \
                        including nested /+ +/ comments and \
                        backquote `string literals`. \
                        \
                        This mode has been dubbed "2.0" because \
                        it is a complete rewrite from scratch. \
                        The previous d-mode was based on \
                        cc-mode 5.28 or so. This version is \
                        based on the cc-mode 5.30 derived mode \
                        example by Martin Stjernholm, 2002.

homepage                http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode
platforms               darwin
master_sites            http://www.billbaxter.com/etc/
distname                d-mode.el
distfiles               ${distname}
checksums               md5     48da4b1713f5cac8db745dd31bc0a7cd \
                        sha1    d8528a41b16d1ca288df5f5c790e276f2e76ed4f \
                        rmd160  4da89b5c5d5f354d3718715bc5fdc3a33dd9a468
use_configure           no

depends_lib             path:${prefix}/bin/emacs:emacs

extract.mkdir yes
extract {
    copy ${distpath}/${distname} ${worksrcpath}
}

build {
    system "cd ${worksrcpath} && \
            emacs --batch --eval \
              '(progn (setq load-path (cons \".\" load-path)) \
                      (byte-compile-file \"d-mode.el\"))'"
}

destroot {
    xinstall -d -m 755 ${destroot}${prefix}/share/emacs/site-lisp
    xinstall ${worksrcpath}/d-mode.el ${destroot}${prefix}/share/emacs/site-lisp/
    xinstall ${worksrcpath}/d-mode.elc ${destroot}${prefix}/share/emacs/site-lisp/
}

post-install {
    ui_msg "Put the following into your ~/.emacs:"
    ui_msg "(autoload 'd-mode \"d-mode\" \"Major mode for editing D code.\" t)"
    ui_msg "(add-to-list 'auto-mode-alist '(\"\\\\.d\[i]?\\\\'\" . d-mode))"
}
