Emacs Syntax

mapserver-mode for Emacs

There is a mapserver-mode for Emacs available at: https://github.com/AxxL/mapserver-emacs-mode This mode allows syntax-highlighting and code-indentation when a MapServer mapfile is opened in Emacs.

Please report issues directly via GitHub or via the mapserver-users list. There are still some issues around.


You can grab the necessary file at: https://github.com/AxxL/mapserver-emacs-mode/blob/master/mapserver-mode.el

Put it into: $HOME/.emacs.d/lisp/

You need to add the following lines to your $HOME/.emacs.d/init.el

(autoload „mapserver-mode «mapserver-mode» «Mode for editing UMN MapServer files.» t) (add-to-list „auto-mode-alist „(»\.map\“» . mapserver-mode))

If you haven’t specified your load-path it is a good idea to do it now. Put the following line before the other two lines.

(add-to-list „load-path «~/.emacs.d/lisp»)

Some help for Emacs is available at the Emacs Wiki


This file is a fork of Hal Muellers mapserver-mode which he announced nearly 10 years ago at the mapserver-users list. I simply updated the keywords and constants to the newest version and adjusted the regular expressions a bit.

The original file seems to be based on the Mode Tutorial by Scott Andrew Borton. See also the Sample Major Mode example by Stefan Monnier if you want to write your own mode.

In combination with yasnippet and auto-complete-mode you should have a nice way to edit mapfiles in your beloved Emacs environment.