www.delorie.com/gnu/docs/gforth/gforth_240.html   search  
Buy GNU books!

Gforth Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12. 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:

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 require `etags.fs', a new `TAGS' file will be produced (see section `Tags Tables' in Emacs Manual) 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 the best behaviour with `etags.fs', you should avoid putting definitions both before and after require etc., otherwise you will see the same file visited several times by commands like tags-search.

Moreover, for words documented in this manual, you can look up the glossary entry quickly by using C-h TAB (info-lookup-symbol, see section `Documentation Commands' in Emacs Manual). This feature requires Emacs 20.3 or later and does not work for words containing :.

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))

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003