Difference between revisions of "Emacs"

From Apertium
Jump to navigation Jump to search
(M-n, M-p)
Line 15: Line 15:
I use [[Format dictionaries|Apertium-dixtools]]-formatted dix, not all functions have been tested in the regular format.
I use [[Format dictionaries|Apertium-dixtools]]-formatted dix, not all functions have been tested in the regular format.


The minor mode adds keyboard shortcuts <code>C-c L</code> and <code>C-c R</code> which make LR or RL restricted copies of &lt;e&gt;'s (use <code>C-TAB</code> to cycle between restriction possibilities LR, RL or none), <code>C-c G</code> which finds the pardef of a dictionary entry (and lets you go back with <code>C-u C-SPC</code>) and <code>C-c S</code> which sorts a pardef by its right-hand-side &lt;r&gt;. <code>M-n</code> and <code>M-p</code> move to the next and previous "important bits" of &lt;e&gt;-elements (just try it!). Inside a pardef, <code>C-c A</code> shows all usages of that pardef within the dictionaries represented by the string `dix-dixfiles', while <code>C-c D</code> gives you a list of all pardefs which use these suffixes (where a suffix is the contents of an &lt;l&gt;-element).
The minor mode adds keyboard shortcuts <code>C-c L</code> and <code>C-c R</code> which make LR or RL restricted copies of &lt;e&gt;'s (use <code>C-TAB</code> to cycle between restriction possibilities LR, RL or none), <code>C-c G</code> which finds the pardef of a dictionary entry (and lets you go back with <code>C-u C-SPC</code>) and <code>C-c S</code> which sorts a pardef by its right-hand-side &lt;r&gt;. <code>M-n</code> and <code>M-p</code> move to the next and previous "important bits" of &lt;e&gt;-elements (just try it!). Inside a pardef, <code>C-c A</code> shows all usages of that pardef within the dictionaries represented by the variable `dix-dixfiles', while <code>C-c D</code> gives you a list of all pardefs which use these suffixes (where a suffix is the contents of an &lt;l&gt;-element).


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




== See also ==
== See also ==

Revision as of 19:28, 6 August 2009

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 (use C-TAB to cycle between restriction possibilities LR, RL or none), 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>. M-n and M-p move to the next and previous "important bits" of <e>-elements (just try it!). Inside a pardef, C-c A shows all usages of that pardef within the dictionaries represented by the variable `dix-dixfiles', while C-c D gives you a list of all pardefs which use these suffixes (where a suffix is the contents of an <l>-element).

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