Alternative ox-mode
ox-mode is a major mode for emacs, used for editing Ox source files. It provides syntax highlighting (aka font-lock), compile mode, imenu support (to list functions in the current buffer), a menu bar, and basic debugging support. Ox is an econometric programming language, available from http://www.doornik.com/products.html#Ox.
I've only tested this package in emacs 22 (prerelease) and XEmacs 21.4.19 on Windows. Please let me know if you have problems or fixes for other platforms. Note that the package is based heavily on the "derived-mode-ex.el" example code for cc-mode extensions.
Steps:
- Make sure your cc-mode version is at least 5.30. To see what version you have, run "M-x c-version" at some point when cc-mode has been loaded. You can get the latest version from http://cc-mode.sourceforge.net/. If you're using an older version of XEmacs, you use the xemacs package manager to update it (the package version 1.45 for cc-mode contains a recent enough version). cc-mode went through a lot of api improvements around 5.30, so it would probably not be practical to backport this.
- Download the emacs lisp file: ox-mode.el to some directory in your emacs load-path.
- You can add a directory to the load-path by adding a line like this to your ".emacs" file:
(setq load-path (cons "c:/data/emacs" load-path))
- You can add a directory to the load-path by adding a line like this to your ".emacs" file:
- In your .emacs, add the line:
(require 'ox-mode)
- Load a ".ox" file to test. Hopefully you'll get syntax highlighting.
This was motivated by the original ox-mode from Michael Höhle (http://www.dina.kvl.dk/~hoehle/software/ox/ox-mode.txt). That approach (which applies diffs to the original cc-mode files in emacs) didn't seem to work well for new versions of emacs.
In ox files, this will automatically add the keybindings "control-c o" to run the current buffer through the ox interpreter, or "control-c p" to parse the buffer without running it (to check for syntax errors). Both functions are available from a menu. The menu bar also includes an "OxFunctions" item that lists all functions in the current buffer, so you can skip to a function definition by selecting its corresponding menu item. This will only work smoothly if you put a function name and argument list on one line followed by an open brace at the beginning of the next line. You can turn this off by setting "ox-use-imenu" to nil.
. You can choose a different ox interpreter path (the default is just "oxl") with (customize-variable "ox-binary-path"). If your ox code has errors, you'll be able to use the normal emacs "next-error" functions to jump to the appropriate lines.