chevrons for D templates in emacs
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Oct 12 15:22:52 PDT 2008
With the help of Pascal J. Bourguignon on the gnu.emacs.help newsgroup I
got some chevrons working for D templates. The current version has quite
a few shortcomings (no proper nesting and electric behavior could be
better) but it does get us started towards finding a comprehensive
solution.
Paste this into your ~/.emacs (assuming you already use Bill Baxter's
d-mode and of course emacs):
(defun d-chevrons ()
(font-lock-add-keywords
nil '(("\\(!(\\)[^()]*\\()\\)"
0 (progn
(compose-region (match-beginning 1) (match-end 1)
?« 'decompose-region)
(compose-region (match-beginning 2)
(match-end 2)
?» 'decompose-region)
nil))))
(font-lock-mode 1))
(add-hook 'd-mode-hook 'd-chevrons)
The result looks pretty darn yummy.
Andrei
More information about the Digitalmars-d
mailing list