Emacs

From Apertium
Revision as of 05:53, 26 June 2009 by Unhammer (talk | contribs) (dix-mode)
Jump to navigation Jump to search

Emacs has a nice xml editing mode called nXML.

dix-mode

In svn there is a minor mode for editing .dix files, dix.el (or use svn co https://apertium.svn.sourceforge.net/svnroot/apertium/trunk/apertium-tools). It uses nxml-mode.

Usage:

 (add-to-list 'load-path "/path/to/dix.el")
 (require 'dix)
 (add-hook 'nxml-mode-hook
 	  (lambda () (if (string-match "\\.dix$" buffer-file-name) (dix-mode 1))))

I use Apertium-dixtools-formatted dix, not all functions have been tested in the regular format. The minor mode adds keyboard shortcuts C-c L and C-c R which make LR or RL restricted copies of <e>'s, C-c G which finds the pardef of a dictionary entry (and lets you go back with C-u C-SPC) and C-c S which sorts a pardef by its right-hand-side <r>.

Also, if you like having all <i> elements aligned at eg. column 25, the minor mode lets you do M-x align on a region to achieve that, and also aligns <p> to 10 and <r> to 44 (for bidix). These numbers are customizable with M-x customize-group RET dix. (Ie. there's no extra indentation function, but then nxml already has that.)


See also

Emacs C style for Apertium hacking