Pure mode is a major mode for editing and running programs written in the Pure programming language [1]. It supports indentation, syntax highlighting (using font-lock), completion of Pure symbols, integrated help (using emacs-w3m), and running Pure scripts and evaluating Pure code in a comint buffer.

Pure mode is included in the Pure sources and is installed along with the interpreter if Emacs is detected at configure time. To enable it, put the following in your .emacs:

(require 'pure-mode)
(setq auto-mode-alist
      (cons '("\\.pure\\(rc\\)?$" . pure-mode) auto-mode-alist))
(add-hook 'pure-mode-hook 'turn-on-font-lock)
(add-hook 'pure-eval-mode-hook 'turn-on-font-lock)

This loads Pure mode, associates the .pure and .purerc filename extensions with it, and enables syntax highlighting.

Pure mode also has special support for code folding using HideShow mode. If it detects the presence of HideShow, it will teach it how to fold comments and code blocks (case ... end, with ... end etc.) in Pure, by modifying hs-special-modes-alist accordingly. To enable this, simply load HideShow mode before Pure mode in your .emacs (the second line also enables HideShow in all your Pure buffers):

(require 'hideshow)
(add-hook 'pure-mode-hook 'hs-minor-mode)

Pure has online documentation in html format. To make the online help work inside emacs, install a recent cvs snapshot of emacs-w3m (1.4 or later will do) and enable it as follows in your .emacs:

(require 'w3m-load)

Pure mode detects the presence of emacs-w3m and you can then look up the symbol at point or just browse the Pure documentation by popping up an emacs-w3m window in Emacs with the pure-help command. (In addition, documentation in info format for use with InfoMode is available in the pure-lang-docs repo [2]. This is generated using Sphinx [3] from the same sources as the html documentation and thus the formatting is a bit rough. In particular, the cross references look best if you set Info-hide-note-references to 'hide and Info-refill-paragraphs to t.)