This page describes how to enable Vala syntax highlighting and code browser support in GNU Emacs. vala-mode is based on csharp-mode.


If You have package.el (included in Emacs 24 by default) -- just use

  • M-x package-install vala-mode


  • Download vala-mode.el in your ~/.emacs.d/

  • Add the following snippet to your ~/.emacs

    (add-to-list 'load-path (expand-file-name "~/.emacs.d"))
    (autoload 'vala-mode "vala-mode" "Major mode for editing Vala code." t)
    (add-to-list 'auto-mode-alist '("\\.vala$" . vala-mode))
    (add-to-list 'auto-mode-alist '("\\.vapi$" . vala-mode))
    (add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
    (add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))

Code Browser

This is an optional configuration which is nice if you want to use Emacs Code Browser (ECB) and the CEDET package together with vala-mode. When you have successfully installed these packages as described on their homepages, you may use the C# semantics to get the wanted functionality also for Vala. It may not be perfect, but hopefully sufficient:

(add-hook 'vala-mode-hook #'wisent-csharp-default-setup)


This file is packaged in Debian GNU/Linux as vala-mode-el.

Lexical Scoping

A patch to change constructs like

   `(lambda (x) (foo x ',(f a b c)))

into closures like

   (let ((fabc (f a b c)))
     (lambda (x) (foo x facb)))

is available on the branch lexical in the repository git://

Projects/Vala/Emacs (last edited 2013-11-22 16:48:27 by WilliamJonMcCann)