Go to the first, previous, next, last section, table of contents.

Emacs and Gforth

Gforth comes with `gforth.el', an improved version of `forth.el' by Goran Rydqvist (included in the TILE package). The improvements are a better (but still not perfect) handling of indentation. I have also added comment paragraph filling (M-q), commenting (C-x \) and uncommenting (C-u C-x \) regions and removing debugging tracers (C-x ~, see section Debugging). I left the stuff I do not use alone, even though some of it only makes sense for TILE. To get a description of these features, enter Forth mode and type C-h m.

In addition, Gforth supports Emacs quite well: The source code locations given in error messages, debugging output (from ~~) and failed assertion messages are in the right format for Emacs' compilation mode (see section `Running Compilations under Emacs' in Emacs Manual) so the source location corresponding to an error or other message is only a few keystrokes away (C-x ` for the next error, C-c C-c for the error under the cursor).

Also, if you include `etags.fs', a new `TAGS' file (see section `Tags Tables' in Emacs Manual) will be produced that contains the definitions of all words defined afterwards. You can then find the source for a word using M-.. Note that emacs can use several tags files at the same time (e.g., one for the Gforth sources and one for your program, see section `Selecting a Tags Table' in Emacs Manual). The TAGS file for the preloaded words is `$(datadir)/gforth/$(VERSION)/TAGS' (e.g., `/usr/local/share/gforth/0.2.0/TAGS').

To get all these benefits, add the following lines to your `.emacs' file:

(autoload 'forth-mode "gforth.el")
(setq auto-mode-alist (cons '("\\.fs\\'" . forth-mode) auto-mode-alist))

Go to the first, previous, next, last section, table of contents.