Basic Emacs for Linguistics 187 If you already know how to use emacs, you can ignore this handout, although you may want to read the part about .lfg files. Starting Emacs: We will be using the text editor "emacs" to write grammars. It is possible to write grammars using other editors. However, XLE comes with a special emacs library that makes writing grammars and running them much simpler. To start up emacs, type emacs & at the command line. A window will pop up that you can type in to create documents, including grammar files. If you want to edit an existing file, type emacs FILENAME & where FILENAME is the name of the relevant file. At the top of the window are menu items. The main ones you will need are: File: open a file that you want to edit save a file that you have edited or created exit emacs (make sure to SAVE your file before you EXIT) Edit: undo (very handy if you make a mistake) cut paste Buffers: choose a buffer from the ones you have loaded; this allows you to edit multiple files in one emacs window Help: emacs tutorial (if you have never used emacs, you should go through a bit of this) There are also keyboard commands for all of these. Many of them are listed on the emacs cheat sheet. LFG Emacs: If you have a file whose name ends with .lfg and you have modified your .emacs file as indicated in the instructions on running xle, then you will get a special menu item in emacs. This will be called LFG. This will have options such as: start an XLE process (starts up xle for you) Rules, templates, lexicons (lists the rules, etc for that file) The xle documentation (obtainable by starting xle and then typing "documentation") has a special section on using emacs with grammar files. You may wish to read this section.